Skip to content

Commit 791ba83

Browse files
Jing-yilinclaude
andcommitted
Review fixes: focus behind a modal, the model tick, a stray tab stop
- A canvas tab's Move to Trash… opens its modal in the top window, and Radix then gave focus back to the tab in the canvas's frame, behind it, where Escape no longer cancelled. The menu leaves focus alone while a dialog is open. - The tick is the ItemIndicator's to place, so it sits at the row's end again rather than against the model's name. - The agent menu hands focus back to the bar's button, which its stand-in anchor cannot take. - The device filter's grid takes no tab stop of its own, and neither menu box draws a focus ring when opened from the keyboard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 0b98f46 commit 791ba83

4 files changed

Lines changed: 32 additions & 21 deletions

File tree

‎canvas/src/ChatPanel.tsx‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,8 +1756,8 @@ export function ChatPanel(props: {
17561756
</small>
17571757
)}
17581758
</span>
1759-
<DropdownMenu.ItemIndicator>
1760-
<Check className="sp-menu-ck" />
1759+
<DropdownMenu.ItemIndicator className="sp-menu-ck">
1760+
<Check />
17611761
</DropdownMenu.ItemIndicator>
17621762
</DropdownMenu.RadioItem>
17631763
))}
@@ -1812,7 +1812,11 @@ export function ChatPanel(props: {
18121812
className="sp-chat-agents"
18131813
align="start"
18141814
sideOffset={4}
1815-
onCloseAutoFocus={(event) => event.preventDefault()}
1815+
// Back to the bar's button, which the stand-in can't take.
1816+
onCloseAutoFocus={(event) => {
1817+
event.preventDefault();
1818+
document.querySelector<HTMLElement>(".sp-agent-toggle")?.focus();
1819+
}}
18161820
>
18171821
<DropdownMenu.RadioGroup
18181822
value={agent}
@@ -1830,8 +1834,8 @@ export function ChatPanel(props: {
18301834
{a.name}
18311835
{!a.available && <small>{a.missing}</small>}
18321836
</span>
1833-
<DropdownMenu.ItemIndicator>
1834-
<Check className="sp-menu-ck" />
1837+
<DropdownMenu.ItemIndicator className="sp-menu-ck">
1838+
<Check />
18351839
</DropdownMenu.ItemIndicator>
18361840
</DropdownMenu.RadioItem>
18371841
))}

‎canvas/src/Community.tsx‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -264,18 +264,17 @@ export function CommunityCards({
264264
duplicate?: Duplicate;
265265
limit: number;
266266
}) {
267+
const all = useCommunity();
267268
return (
268269
<ul className="home-grid">
269-
{useCommunity()
270-
.slice(0, limit)
271-
.map((e) => (
272-
<Card
273-
key={e.id}
274-
entry={e}
275-
onOpen={() => openInApp(e.id)}
276-
menu={cardMenu(e, openInApp, duplicate)}
277-
/>
278-
))}
270+
{all.slice(0, limit).map((e) => (
271+
<Card
272+
key={e.id}
273+
entry={e}
274+
onOpen={() => openInApp(e.id)}
275+
menu={cardMenu(e, openInApp, duplicate)}
276+
/>
277+
))}
279278
</ul>
280279
);
281280
}
@@ -445,7 +444,7 @@ export function CommunityPage({
445444
</div>
446445
)}
447446
<Tabs.Content value={family} asChild>
448-
<ul className="cm-grid" aria-live="polite">
447+
<ul className="cm-grid" aria-live="polite" tabIndex={-1}>
449448
{shown.map((e) => (
450449
<Card
451450
key={e.id}

‎canvas/src/contextMenu.tsx‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,16 @@ export function RightClickMenu({
1919
<ContextMenu.Root>
2020
<ContextMenu.Trigger asChild>{children}</ContextMenu.Trigger>
2121
<ContextMenu.Portal>
22-
<ContextMenu.Content className="sp-context-menu">
22+
<ContextMenu.Content
23+
className="sp-context-menu"
24+
// An item that asks first (confirmTrash) opens a modal in the top window; handing focus
25+
// back to the menu's owner in the canvas's frame would take it from behind that modal,
26+
// where Escape no longer cancels.
27+
onCloseAutoFocus={(event) => {
28+
if (window.top!.document.querySelector("dialog[open]"))
29+
event.preventDefault();
30+
}}
31+
>
2332
{menu}
2433
</ContextMenu.Content>
2534
</ContextMenu.Portal>

‎canvas/src/index.css‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,7 @@ button {
10641064
.sp-context-menu {
10651065
--sp-hover: var(--ds-gray-100);
10661066
z-index: 1000;
1067+
outline: none;
10671068
min-width: 180px;
10681069
padding: 4px;
10691070
border: 1px solid var(--ds-gray-400);
@@ -1094,6 +1095,7 @@ a.sp-menu-row {
10941095
}
10951096

10961097
.sp-menu-ck {
1098+
display: flex;
10971099
flex: none;
10981100
margin-left: auto;
10991101
color: var(--sp-text-2);
@@ -2491,6 +2493,7 @@ a.sp-menu-row {
24912493
.sp-chat-agents,
24922494
.sp-chat-picker {
24932495
z-index: 1000;
2496+
outline: none;
24942497
margin: 0;
24952498
padding: 4px;
24962499
border: 1px solid var(--sp-line);
@@ -2580,10 +2583,6 @@ a.sp-menu-row {
25802583
padding: 6px 8px;
25812584
}
25822585

2583-
.sp-chat-agents .sp-menu-row[data-disabled] {
2584-
color: var(--sp-text-2);
2585-
}
2586-
25872586
/* A mark in its brand colour beside greyed-out text reads as the available one, and Claude's is
25882587
a fixed terracotta rather than currentColor, so the row dims the mark itself. */
25892588
.sp-chat-agents .sp-menu-row[data-disabled] svg {

0 commit comments

Comments
 (0)