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 now one Tab stop with roving tabindex, arrow keys move cells and the row-number gutter (and can flow between stacked grids), Tab leaves the grid, gutter Delete removes rows, and click-to-select then click-to-edit opens the cell editor (including for mouse users). The scenario form’s Initial State section wraps per-place spreadsheets in Adds Reviewed by Cursor Bugbot for commit 0ed9188. Bugbot is set up for automated code reviews on this repo. 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