Skip to content

fix(shop/Select): move 'onKeyDown' from wrapper 'div' to trigger 'button' for a11y#907

Open
sukvvon wants to merge 1 commit intoTanStack:mainfrom
sukvvon:fix/shop-select-onkeydown-a11y
Open

fix(shop/Select): move 'onKeyDown' from wrapper 'div' to trigger 'button' for a11y#907
sukvvon wants to merge 1 commit intoTanStack:mainfrom
sukvvon:fix/shop-select-onkeydown-a11y

Conversation

@sukvvon
Copy link
Copy Markdown
Contributor

@sukvvon sukvvon commented May 9, 2026

Summary

  • The wrapper <div> in ShopSelect had an onKeyDown handler without a role, which violates the jsx-a11y/no-static-element-interactions rule and causes lint to fail
  • Moves the handler to the trigger <button>, which is always the focus holder in this component (focus stays on the trigger; option <button> hover only updates a focused state, not DOM focus)
  • Preserves the keyboard navigation (arrows, Enter, Escape) introduced in feat(shop): animation polish, sticky filter bar & custom dropdowns #898 — no user-facing behavior change
  • Resolves the lint failure that has been blocking CI on PRs branched from main

Test plan

  • Open /shop and use the sort dropdown via keyboard: Tab to focus, Enter/Space/ArrowDown to open, Arrow keys to move, Enter to select, Escape to close
  • Confirm pnpm test passes locally with Found 10 warnings and 0 errors.

Summary by CodeRabbit

  • Bug Fixes
    • Improved keyboard navigation behavior for the select component.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 9, 2026

👷 Deploy request for tanstack pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 787e787

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 9, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8d325e0d-4960-48c1-9643-43cedd8d3d80

📥 Commits

Reviewing files that changed from the base of the PR and between ed7f3fa and 787e787.

📒 Files selected for processing (1)
  • src/components/shop/ui/Select.tsx

📝 Walkthrough

Walkthrough

ShopSelect component's keyboard navigation handler is relocated from the outer wrapper div to the trigger button element. This change ties keyboard event handling directly to the focused button, rather than the container.

Changes

Select Keyboard Handler Relocation

Layer / File(s) Summary
Button Keyboard Handler
src/components/shop/ui/Select.tsx
The onKeyDown={onKeyDown} handler is moved from the outer container div to the trigger button element (lines 97–103).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A button takes its rightful place,
With keyboard keys now face to face,
No wrapper holds the events tight,
The interaction feels just right! 🐰⌨️

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: moving the onKeyDown handler from a wrapper div to the trigger button for accessibility reasons.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant