fix(app): hide browser when the right panel closes (#49425)

This commit is contained in:
David Hill
2026-09-17 04:39:02 -06:00
committed by GitHub
Unverified
parent 430886142b
commit ac0dd75c6a
3 changed files with 25 additions and 1 deletions
@@ -42,3 +42,18 @@ story("hides and restores the same registration for Review tabs and unmount", as
await root.getByRole("button", { name: "Unmount pane", exact: true }).click()
await expect(root.getByTestId("native-Alpha")).toHaveAttribute("data-visible", "false")
})
story("hides the native view immediately while the pane stays mounted", async ({ page }) => {
const root = page.getByTestId("browser-pane-fixture")
const toggle = root.getByRole("button", { name: "Toggle Review tab", exact: true })
await expect(toggle).toBeEnabled()
// Read in the same task as the click so a deferred animation-frame hide cannot pass.
const visible = await toggle.evaluate((element) => {
element.dispatchEvent(new MouseEvent("click", { bubbles: true }))
return document.querySelector('[data-testid="native-Alpha"]')?.getAttribute("data-visible")
})
expect(visible).toBe("false")
await expect(root.locator("#browser-panel")).toHaveCount(1)
await toggle.click()
await expect(root.getByTestId("native-Alpha")).toHaveAttribute("data-visible", "true")
})
@@ -127,6 +127,12 @@ export function SessionBrowserPane(props: { browser: ReturnType<typeof createSes
],
() => {
layout = undefined
// Native views are not clipped by the retained panel's DOM. Hide before
// the next animation frame so closing the panel cannot leave its page above the app.
if (!props.visible || !store.visible || dialog.active || !state()) {
registration()?.setLayout()
return
}
schedule(300)
},
),
@@ -595,7 +595,10 @@ export function SessionSidePanel(props: {
classList={{ hidden: !isSessionBrowserTab(activeTab()) }}
inert={!isSessionBrowserTab(activeTab()) || undefined}
>
<SessionBrowserPane browser={props.browser} visible={isSessionBrowserTab(activeTab())} />
<SessionBrowserPane
browser={props.browser}
visible={reviewOpen() && isSessionBrowserTab(activeTab())}
/>
</div>
</Show>