Update web_src/js/features/file-view.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: hamkido <hamki.do2000@gmail.com>
This commit is contained in:
hamkidoandCopilot authored and GitHub committed 2026-01-26 17:19:07 +08:00
1 parent 5896a80421
commit 24f253fe44
1 file changed
+7 -2
+7 -2
View File
@@ -132,8 +132,13 @@ function initSidebarToggle(elFileView: HTMLElement): void {
// For file view, first add margin, wait for layout, then show sidebar
if (isFileView && repoViewContent) {
repoViewContent.classList.add('sidebar-visible');
// Wait for CSS transition to complete (200ms) before calculating position
setTimeout(showAfterLayout, 220);
// Wait for CSS transition to actually complete before calculating position
const onTransitionEnd = (event: TransitionEvent) => {
if (event.target !== repoViewContent) return;
repoViewContent.removeEventListener('transitionend', onTransitionEnd);
showAfterLayout();
};
repoViewContent.addEventListener('transitionend', onTransitionEnd);
} else {
// For home page (README), no margin needed, show with small delay
setTimeout(showAfterLayout, 10);