From ccc4ee6053719da50fef8cb4ec6a4109c5bbc3d6 Mon Sep 17 00:00:00 2001
From: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
Date: Thu, 12 Nov 2026 14:51:13 -0800
Subject: [PATCH] fix(browser): clip the narrow browser toolbar without making
it scrollable
overflow-hidden still made the browser overlay slot a scroll container, so
tabbing to a toolbar control clipped in a narrow group scrolled the toolbar
and page sideways with no way back. overflow-clip clips the same way without
a scroll position.
---
.../BrowserPaneOverlayLayer.tsx | 4 +-
...-group-divider-narrow-browser-drag.spec.ts | 41 +++++++++++++++++++
2 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/src/renderer/src/components/browser-pane/assemble-chrome/BrowserPaneOverlayLayer.tsx b/src/renderer/src/components/browser-pane/assemble-chrome/BrowserPaneOverlayLayer.tsx
index a96c36dd36c..4261c7e243c 100644
--- a/src/renderer/src/components/browser-pane/assemble-chrome/BrowserPaneOverlayLayer.tsx
+++ b/src/renderer/src/components/browser-pane/assemble-chrome/BrowserPaneOverlayLayer.tsx
@@ -100,8 +100,8 @@ const BrowserOverlaySlot = memo(function BrowserOverlaySlot({
return (
{
.poll(() => groupWidth(orcaPage, fixture.browserGroupId))
.toBeGreaterThan(shrunkWidth + 20)
})
+
+ test('keeps a narrow browser toolbar from scrolling when a clipped control takes focus', async ({
+ orcaPage
+ }) => {
+ await orcaPage.setViewportSize({ width: 1000, height: 700 })
+ const fixture = await createTerminalBrowserSplit(orcaPage, server.pageUrl('clip', 1))
+ await waitForBrowserGuestRegistration(orcaPage, fixture.browserTabId, fixture.browserPageId)
+ // Size the browser group to about 150px, narrower than its toolbar.
+ await orcaPage.evaluate(({ terminalGroupId, browserGroupId }) => {
+ const width = (id: string): number =>
+ document
+ .querySelector(`[data-tab-group-body-id="${id}"]`)!
+ .getBoundingClientRect().width
+ const row = width(terminalGroupId) + width(browserGroupId)
+ const state = window.__store!.getState()
+ state.setTabGroupSplitRatio(state.activeWorktreeId!, '', 1 - 150 / row)
+ }, fixture)
+ await expect.poll(() => groupWidth(orcaPage, fixture.browserGroupId)).toBeLessThan(160)
+
+ const overlay = orcaPage.locator(`[data-browser-overlay-tab-id="${fixture.browserTabId}"]`)
+ const menu = overlay.getByRole('button', { name: 'Browser menu' })
+ await overlay.getByRole('button', { name: 'Reload' }).focus()
+ await expect(async () => {
+ await orcaPage.keyboard.press('Tab')
+ await expect(menu).toBeFocused({ timeout: 200 })
+ }).toPass({ timeout: 10_000 })
+
+ // Nothing between the focused control and the document may scroll sideways to reveal it.
+ const scrolled = await menu.evaluate((button) => {
+ const offsets: string[] = []
+ for (let node: Element | null = button; node; node = node.parentElement) {
+ if (node.scrollLeft !== 0) {
+ offsets.push(
+ `${node.tagName.toLowerCase()}.${String(node.className).slice(0, 40)}=${node.scrollLeft}`
+ )
+ }
+ }
+ return offsets
+ })
+ expect(scrolled).toEqual([])
+ })
})