mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-20 01:08:31 +03:00
fix(app): hide browser when the right panel closes (#49425)
This commit is contained in:
committed by
GitHub
Unverified
parent
430886142b
commit
ac0dd75c6a
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user