From 7443db6e6616274f8ebc9c5d743a2118c9333556 Mon Sep 17 00:00:00 2001 From: John Walley Date: Wed, 31 Aug 2022 22:33:40 +0100 Subject: [PATCH] fix: enable pane content focus on mount (#404) --- src/allotment.module.css | 4 ---- src/allotment.tsx | 2 +- src/split-view/split-view.ts | 3 +-- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/allotment.module.css b/src/allotment.module.css index bcd01fd2..4c5fdfbd 100644 --- a/src/allotment.module.css +++ b/src/allotment.module.css @@ -33,10 +33,6 @@ white-space: initial; } -.splitView > .splitViewContainer > .splitViewView:not(.visible) { - display: none; -} - .splitView.vertical > .splitViewContainer > .splitViewView { width: 100%; } diff --git a/src/allotment.tsx b/src/allotment.tsx index 6db3b9c5..502b565c 100644 --- a/src/allotment.tsx +++ b/src/allotment.tsx @@ -295,7 +295,7 @@ const Allotment = forwardRef( /** * Add, remove or update views as children change */ - useEffect(() => { + useIsomorphicLayoutEffect(() => { if (dimensionsInitialized) { const keys = childrenArray.map((child) => child.key as string); const panes = [...previousKeys.current]; diff --git a/src/split-view/split-view.ts b/src/split-view/split-view.ts index 2edb7987..a7346dff 100644 --- a/src/split-view/split-view.ts +++ b/src/split-view/split-view.ts @@ -176,7 +176,7 @@ abstract class ViewItem { if (typeof size === "number") { this._size = size; this._cachedVisibleSize = undefined; - container.classList.add("split-view-view-visible", styles.visible); + container.classList.add("split-view-view-visible"); } else { this._size = 0; this._cachedVisibleSize = size.cachedVisibleSize; @@ -225,7 +225,6 @@ abstract class ViewItem { this.size = 0; } - this.container.classList.toggle(styles.visible, visible); this.container.classList.toggle("split-view-view-visible", visible); if (this.view.setVisible) {