fix(makeselectable): fix arrow key navigation for menus inside table#4455
fix(makeselectable): fix arrow key navigation for menus inside table#4455mergify[bot] merged 2 commits intobox:masterfrom
Conversation
WalkthroughThe changes expand dropdown menu detection logic to recognize both Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/components/table/makeSelectable.js (1)
649-651: Scope menu detection to visible/open menus to avoid false navigation lockouts.The global
[role="menu"]check can match hidden or persistent menu containers and block table arrow navigation even when no dropdown is actively open. Consider filtering matched nodes by visible/open state.Proposed refinement
- isDropdownMenuOpen = () => - document.querySelector('.dropdown-menu-element') !== null || - document.querySelector('[role="menu"]') !== null; + isDropdownMenuOpen = () => + Array.from(document.querySelectorAll('.dropdown-menu-element, [role="menu"]')).some( + el => !el.hasAttribute('hidden') && el.getAttribute('aria-hidden') !== 'true', + );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/table/makeSelectable.js` around lines 649 - 651, The isDropdownMenuOpen function currently returns true for any matching .dropdown-menu-element or [role="menu"] in the document, which can include hidden/persistent containers; update isDropdownMenuOpen to only consider nodes that are actually visible/open by filtering the querySelector results for visible state (e.g., check aria-expanded="true" on the toggle, computed style visibility/display, non-empty boundingClientRect, or offsetParent) and/or requiring a class that denotes the open state; locate and modify the isDropdownMenuOpen arrow function and apply the visibility filtering to the node(s) returned for both '.dropdown-menu-element' and '[role="menu"]' checks so only active menus block table arrow navigation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/components/table/makeSelectable.js`:
- Around line 649-651: The isDropdownMenuOpen function currently returns true
for any matching .dropdown-menu-element or [role="menu"] in the document, which
can include hidden/persistent containers; update isDropdownMenuOpen to only
consider nodes that are actually visible/open by filtering the querySelector
results for visible state (e.g., check aria-expanded="true" on the toggle,
computed style visibility/display, non-empty boundingClientRect, or
offsetParent) and/or requiring a class that denotes the open state; locate and
modify the isDropdownMenuOpen arrow function and apply the visibility filtering
to the node(s) returned for both '.dropdown-menu-element' and '[role="menu"]'
checks so only active menus block table arrow navigation.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/table/__tests__/makeSelectable.test.jssrc/components/table/makeSelectable.js
Merge Queue StatusRule:
This pull request spent 10 minutes 43 seconds in the queue, including 10 minutes 32 seconds running CI. Required conditions to merge
|
Fix arrow keys navigation with
makeSelectabletable helper for other types of dropdown menus (besides BUIE dropdown menu).Summary by CodeRabbit