The gap
dashboard-tree.ts's buildDeleteButton (the orphaned-variable's trash
confirm, dashboard-tree.ts:779) opens its openMenu confirm with the same
row order #466 just fixed in tabs.ts's requestCloseTab: the destructive
item ("Delete option SQL") listed before "Cancel". openMenu autofocuses the
first focusable row by default, so a keyboard user who opens this confirm and
immediately presses Enter — the browser's native focused-button activation —
deletes the stored SQL by default, with no per-variable undo.
#466 (PR #499) added MenuRow.item.autofocus?: boolean to src/ui/menu.ts
specifically so a caller can keep the destructive-first visual order (the
convention buildDeleteButton itself established) while still defaulting
keyboard focus to Cancel. Fixing this instance is a one-line addition:
autofocus: true on buildDeleteButton's own { kind: 'item', label: 'Cancel', ... } row (dashboard-tree.ts ~line 813).
Why deferred
Out of scope for #466, which only touches the tab strip's own close confirm.
Surfaced by an independent code-review pass on that PR, which explicitly
flagged that fixing the new call site without touching this pre-existing one
would leave the identical risk in place. A dashboard-tree.test.ts (or e2e)
regression test asserting the Cancel button is the initially-focused element
should land in the same change.
The gap
dashboard-tree.ts'sbuildDeleteButton(the orphaned-variable's trashconfirm,
dashboard-tree.ts:779) opens itsopenMenuconfirm with the samerow order #466 just fixed in
tabs.ts'srequestCloseTab: the destructiveitem ("Delete option SQL") listed before "Cancel".
openMenuautofocuses thefirst focusable row by default, so a keyboard user who opens this confirm and
immediately presses Enter — the browser's native focused-button activation —
deletes the stored SQL by default, with no per-variable undo.
#466 (PR #499) added
MenuRow.item.autofocus?: booleantosrc/ui/menu.tsspecifically so a caller can keep the destructive-first visual order (the
convention
buildDeleteButtonitself established) while still defaultingkeyboard focus to Cancel. Fixing this instance is a one-line addition:
autofocus: trueonbuildDeleteButton's own{ kind: 'item', label: 'Cancel', ... }row (dashboard-tree.ts~line 813).Why deferred
Out of scope for #466, which only touches the tab strip's own close confirm.
Surfaced by an independent code-review pass on that PR, which explicitly
flagged that fixing the new call site without touching this pre-existing one
would leave the identical risk in place. A
dashboard-tree.test.ts(or e2e)regression test asserting the Cancel button is the initially-focused element
should land in the same change.