Skip to content

Commit d8eecf9

Browse files
t3dotggclaude
andcommitted
fix(web): hover popups no longer swallow F6; workspace areas show focus
- Only a modal, or a popup that holds focus, stops F6. - A keyboard-made click on a legacy project row is never taken for the click after a right-click, so ArrowRight/Left toggle it. - An area that takes focus itself shows a focus-visible outline. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent c838fd6 commit d8eecf9

6 files changed

Lines changed: 28 additions & 13 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3275,7 +3275,7 @@ export default function ChatView(props: ChatViewProps) {
32753275
/>
32763276
<div
32773277
{...conversationArea}
3278-
className="relative flex min-h-0 flex-1 flex-col bg-background outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"
3278+
className="relative flex min-h-0 flex-1 flex-col bg-background"
32793279
>
32803280
<ThreadTimeline
32813281
threadDetailRef={routeThreadDetailRef}

‎apps/web/src/components/LegacySidebar.tsx‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,9 +1423,12 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
14231423
const handleProjectButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {
14241424
if (suppressProjectClickForContextMenuRef.current) {
14251425
suppressProjectClickForContextMenuRef.current = false;
1426-
event.preventDefault();
1427-
event.stopPropagation();
1428-
return;
1426+
// A keyboard-made click (detail 0) never follows a context menu.
1427+
if (event.detail !== 0) {
1428+
event.preventDefault();
1429+
event.stopPropagation();
1430+
return;
1431+
}
14291432
}
14301433
if (dragInProgressRef.current) {
14311434
event.preventDefault();
@@ -1652,8 +1655,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
16521655

16531656
const handleProjectButtonContextMenu = (event: React.MouseEvent<HTMLButtonElement>) => {
16541657
event.preventDefault();
1655-
// Keyboard menus dispatch an untrusted contextmenu with no click after it.
1656-
suppressProjectClickForContextMenuRef.current = event.isTrusted;
1658+
suppressProjectClickForContextMenuRef.current = true;
16571659
void (async () => {
16581660
const api = readLocalApi();
16591661
if (!api) return;

‎apps/web/src/index.css‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2577,3 +2577,9 @@ code {
25772577
}
25782578
}
25792579
}
2580+
2581+
/* A workspace area with no control of its own takes F6 focus itself; keep that visible. */
2582+
[data-workspace-area]:focus-visible {
2583+
outline: 2px solid var(--ring);
2584+
outline-offset: -2px;
2585+
}

‎apps/web/src/lib/workspaceFocus.browser.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,14 @@ describe("workspace area focus", () => {
247247
header.append(moved);
248248
await vi.waitFor(() => expect(document.activeElement).toBe(moved));
249249
});
250+
251+
it("keeps moving while a hover popup without focus is open", () => {
252+
using fixture = setup();
253+
const composer = fixture.area("composer", 2);
254+
const terminal = fixture.area("terminal", 4);
255+
fixture.append('<div data-slot="popover-popup">New split terminal</div>');
256+
composer.button.focus();
257+
expect(fixture.controller.move(1)).toBe(true);
258+
expect(document.activeElement).toBe(terminal.button);
259+
});
250260
});

‎apps/web/src/lib/workspaceFocus.ts‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,13 @@ export function createWorkspaceFocusController(doc: Document) {
209209
doc.querySelectorAll<HTMLElement>(FOCUS_BOUNDARY_SELECTOR),
210210
).filter((boundary) => boundary !== appModal);
211211
if (activePopup && !activePopup.closest(AREA_SELECTOR)) boundaries.push(activePopup);
212+
// A modal keeps focus wherever it is; any other popup only while it holds focus,
213+
// so hover popups and notifications never swallow the key.
212214
if (
213215
boundaries.some(
214216
(boundary) =>
215217
!(closingPalette && boundary.closest("[data-command-palette]")) &&
216-
// Base UI names notifications as non-modal dialogs, including anchored
217-
// toast popups. Their presence must not block navigation elsewhere.
218-
!(
219-
boundary.matches('[aria-modal="false"]:is([role="dialog"], [role="alertdialog"])') &&
220-
boundary.closest('[data-slot^="toast-viewport"]')
221-
) &&
218+
(boundary.matches('[aria-modal="true"]') || boundary.contains(doc.activeElement)) &&
222219
isWorkspaceElementVisible(boundary),
223220
)
224221
)

‎apps/web/src/routes/_chat.settings.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function SettingsContentLayout() {
120120
<AppRouteModal label="Settings">
121121
<div className="relative flex min-h-0 flex-1">
122122
<SettingsSidebarNav pathname={location.pathname} />
123-
<div {...contentArea} className="flex min-h-0 min-w-0 flex-1 flex-col outline-none">
123+
<div {...contentArea} className="flex min-h-0 min-w-0 flex-1 flex-col">
124124
<header className="flex h-12 shrink-0 items-center gap-3 border-b ps-5 pe-2">
125125
<SettingsBreadcrumb pathname={location.pathname} />
126126
<div className="ms-auto flex shrink-0 items-center gap-1">

0 commit comments

Comments
 (0)