Skip to content

Commit 87dba64

Browse files
fix(web): keep the file explorer resizable with the tree focus handler
The click/Enter wrapper sat between the explorer pane and its row, and as a display:contents box it reported zero width, so the pane capped itself at its 160px minimum. Move the wrapper inside the pane so the pane measures the row. AI-assisted; verified with the tests and tools listed above.
1 parent 635eb1c commit 87dba64

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

‎apps/web/src/components/files/FilePreviewPanel.browser.test.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,18 @@ describe("source file focus", () => {
215215
truncated: false,
216216
};
217217
await using screen = await render(
218-
<div {...workspaceAreaProps("panel", 1, "Workspace panel")}>
218+
<div {...workspaceAreaProps("panel", 1, "Workspace panel")} style={{ width: 900 }}>
219219
<div data-right-panel-surface-content>{filePreview("server.ts")}</div>
220220
</div>,
221221
);
222222
using _focus = {
223223
[Symbol.dispose]: startWorkspaceFocus({ subscribe: () => () => {} } as never),
224224
};
225225
const editorHasFocus = () => expect(deepActiveElement()?.matches("[data-content]")).toBe(true);
226+
// The explorer measures its parent row; a wrapper without a box would cap it at the minimum.
227+
await expect
228+
.element(screen.getByRole("separator", { name: "Resize file explorer" }))
229+
.toHaveAttribute("aria-valuemax", "560");
226230
const folderRow = screen.getByRole("treeitem", { name: "src" });
227231
const fileRow = screen.getByRole("treeitem", { name: "server.ts" });
228232

‎apps/web/src/components/files/FilePreviewPanel.tsx‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,14 +1617,14 @@ export default function FilePreviewPanel({
16171617
) : null}
16181618
</div>
16191619
{showExplorer ? (
1620-
<div
1621-
className="contents"
1622-
onClick={focusEditorOnTreeRowClickOrEnter}
1623-
onKeyDown={(event) => {
1624-
if (event.key === "Enter") focusEditorOnTreeRowClickOrEnter(event);
1625-
}}
1626-
>
1627-
<FileExplorerPane resizable={Boolean(previewPath)}>
1620+
<FileExplorerPane resizable={Boolean(previewPath)}>
1621+
<div
1622+
className="contents"
1623+
onClick={focusEditorOnTreeRowClickOrEnter}
1624+
onKeyDown={(event) => {
1625+
if (event.key === "Enter") focusEditorOnTreeRowClickOrEnter(event);
1626+
}}
1627+
>
16281628
<FileBrowserPanel
16291629
key={`${environmentId}:${hostFolderPath ?? cwd}`}
16301630
environmentId={environmentId}
@@ -1648,8 +1648,8 @@ export default function FilePreviewPanel({
16481648
}
16491649
: {})}
16501650
/>
1651-
</FileExplorerPane>
1652-
</div>
1651+
</div>
1652+
</FileExplorerPane>
16531653
) : null}
16541654
</div>
16551655
</div>

0 commit comments

Comments
 (0)