Skip to content

TT-7622 fix: focus wheel picker on click so keyboard arrows work - #535

Open
nabalone wants to merge 1 commit into
developfrom
TT-7622_wheel-picker-keyboard-arrows
Open

TT-7622 fix: focus wheel picker on click so keyboard arrows work#535
nabalone wants to merge 1 commit into
developfrom
TT-7622_wheel-picker-keyboard-arrows

Conversation

@nabalone

Copy link
Copy Markdown
Collaborator

Summary

Fixes TT-7622: in the Mark Verses → Edit Reference dialog, the Chapter/Verse/Suffix wheel pickers did not respond to the keyboard Up/Down arrow keys after being clicked.

Root cause

The wheel pickers use @ncdai/react-wheel-picker, which does have built-in Arrow-key handling on its internal [data-rwp] element — but that element only receives keyboard focus when tabbed to. On click, the library calls preventDefault() on mousedown (to drive its drag/scroll gesture), and preventDefault on mousedown also stops the browser from moving focus to the element. So after the user clicked a wheel (the exact repro steps), the wheel never had focus and its arrow-key handler never fired.

Fix

Focus the wheel's internal element ourselves in an onClick handler on the wheel column wrapper. Keyboard users who tab in already get focus for free, so this is a no-op for them; it only closes the click-then-arrow gap.

Test plan

  • Verified in the running dev app (real component + real library) via a standalone render harness:
    • Click a verse wheel → focus lands on the wheel; ArrowDown changes 78→79, ArrowUp changes 5→4; the change persists on Save.
    • Confirmed the bug reproduces with the fix removed (click leaves focus off the wheel; arrows do nothing).
  • npm run typecheck — clean
  • eslint on the changed file — clean
  • jest EditReferenceDropdown — 7/7 pass

🤖 Generated with Claude Code

The Edit Reference wheel pickers (@ncdai/react-wheel-picker) have built-in
Arrow-key handling on their internal element, but that element only received
focus when tabbed to. On click the library calls preventDefault() on mousedown
to drive its drag/scroll, which also stops the browser from focusing the wheel,
so after clicking a wheel the Up/Down arrow keys did nothing. Focus the wheel
ourselves on click to close that gap; tab users already get focus for free.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@nabalone
nabalone marked this pull request as ready for review August 26, 2026 00:39
@gtryus
gtryus requested a lite review from Copilot August 26, 2026 15:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes TT-7622 in the Mark Verses → Edit Reference dialog by ensuring the chapter/verse/suffix wheel pickers receive keyboard focus after a mouse click, so their built-in Up/Down arrow key handling works as expected.

Changes:

  • Adds a focusWheelOnClick click handler that focuses the wheel picker’s internal [data-rwp] element.
  • Wires the click handler onto the wheel column wrapper so click-then-arrow works without affecting tab-based keyboard navigation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +304 to +306
const focusWheelOnClick = useCallback((event: MouseEvent<HTMLDivElement>) => {
event.currentTarget.querySelector<HTMLElement>('[data-rwp]')?.focus();
}, []);

@gtryus gtryus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot is suggesting an additional test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants