FE-1544: Rebase the token spreadsheet on the worksheet focus layer - #9418
FE-1544: Rebase the token spreadsheet on the worksheet focus layer#9418kube wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
PR SummaryMedium Risk Overview Each grid is one Tab stop with roving tabindex; arrow keys move between cells and the row-number gutter, Tab is no longer trapped in the grid, and focus hand-off uses a local target map plus Interaction matches the worksheet grammar: select-first clicks open the editor on a second click on the selected cell, Delete on the gutter removes a row while keeping focus in the lane, and the grid exposes Adds Reviewed by Cursor Bugbot for commit 0bc5b0b. Bugbot is set up for automated code reviews on this repo. Configure here. |
0ed9188 to
0bc5b0b
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0bc5b0b. Configure here.
| tabIndex={ | ||
| isReadOnly | ||
| ? undefined | ||
| : tabIndexFor({ stopId, column: "gutter" }) |
There was a problem hiding this comment.
Stale roving tab stop after shrink
Medium Severity
The roving tabIndex is never cleared when the remembered cell disappears. After a type edit drops a column, or parent data shrinks past the last focused row, tabIndexFor matches nothing and every cell stays at -1, so Tab can no longer enter the grid until a click resets memory.
Reviewed by Cursor Bugbot for commit 0bc5b0b. Configure here.


🌟 What is the purpose of this PR?
Rebase the token spreadsheet (place initial state, scenario forms) on the worksheet keyboard-flow layer from #9411, replacing its hand-rolled focus and key routing. This fixes two shipping defects: Tab was intercepted everywhere and swallowed at the last cell, trapping keyboard users, and row focus went through an unscoped
document.querySelector, so a scenario form with several per-place grids could focus the wrong grid.🔗 Related links
🔍 What does this change?
Spreadsheetdelegates movement, tab order, and the row-number lane touseFocusStops: each grid is one Tab stop with a roving tabindex, arrows walk cells and the gutter, and Tab leaves the grid instead of being trapped. The ~250-line hand-rolled key router, thefocusedCell/selectedRowstate, and everysetTimeout/document.querySelectorfocus call are deleted.useRowSelectiongrammar: the row whose gutter holds focus renders selected; Delete there removes the row, and the index-keyed rows keep focus in the lane afterwards.useSelectFirstActivation): the first click selects a cell, a click on the selected cell opens its editor. This also gives mouse users an editing path, which did not exist before (editing was keyboard-only).flushSyncplus the grid's own target map instead of timers and document-wide queries.FocusRoot/FocusStack, so arrows flow from one place's spreadsheet into the next.role="grid"/row/gridcell/rowheaderper the layer's contract, and the uuid overlay is revealed by CSS:focus-withininstead of focus state.t/f/1/0shortcuts now ignore modifier chords (Cmd+T reaches the browser again); printable keys typed into a cell no longer leak to the editor's global single-key shortcuts.Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
v/h/n/t) still reach the canvas, as before this PR. Settling that globally is part of the wider focus-layer adoption.🐾 Next steps
🛡 What tests cover this?
spreadsheet.test.tsx: roving tabindex, arrow movement and the gutter lane, Tab not intercepted, edit open/commit/advance/cancel, phantom-row materialization, gutter delete with focus retention, boolean key handling, select-first clicks, and cross-grid flow inside aFocusStack.focus-flow.test.tsxcovers the underlying layer contract.❓ How to test this?
yarn workspace @hashintel/petrinaut storybook, open Components / Spreadsheet.The grid's visuals are unchanged; the existing docs screenshots stay valid.
🤖 Generated with Claude Code