Skip to content

CODAP-572: fix axis submenu keyboard focus restoration on ArrowLeft#2440

Merged
kswenson merged 1 commit intomainfrom
CODAP-572-fix-axis-submenu-focus
Mar 3, 2026
Merged

CODAP-572: fix axis submenu keyboard focus restoration on ArrowLeft#2440
kswenson merged 1 commit intomainfrom
CODAP-572-fix-axis-submenu-focus

Conversation

@kswenson
Copy link
Member

@kswenson kswenson commented Mar 3, 2026

Summary

  • Fixes keyboard navigation in graph axis hierarchical submenus where ArrowLeft closed the submenu but failed to restore focus to the parent menu
  • Wraps the CollectionMenu submenu in conditional rendering so Chakra internal focus management does not race with the useSubmenuCloseOnArrowLeft hook focus restoration
  • Matches the pattern already used in the working PluginGroupMenu component

Fixes CODAP-572

Test plan

  • Open a graph with hierarchical collections (multiple collections in the dataset)
  • Click an axis label to open the attribute menu
  • Use ArrowDown to navigate to a collection submenu trigger
  • Press ArrowRight to open the submenu
  • Press ArrowLeft to close the submenu - verify focus returns to the parent menu item
  • Continue navigating with ArrowUp/ArrowDown in the parent menu
  • Verify the Plugins menu toolbar submenus still work correctly

Generated with Claude Code

Conditionally render the CollectionMenu submenu so Chakra internal
focus management does not override the hook focus restoration when the
submenu closes, matching the pattern used in PluginGroupMenu.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kswenson kswenson added the v3 CODAP v3 label Mar 3, 2026
@kswenson kswenson requested a review from Copilot March 3, 2026 20:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes keyboard navigation for graph axis/legend attribute hierarchical submenus so that pressing ArrowLeft closes the submenu and correctly restores focus to the parent menu item (CODAP-572), avoiding a race with Chakra UI focus handling.

Changes:

  • Conditionally renders the CollectionMenu submenu only when open to prevent Chakra’s internal focus management from conflicting with useSubmenuCloseOnArrowLeft focus restoration.
  • Adds the shared If conditional-rendering component to match the working submenu pattern used elsewhere (e.g., plugins menu).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cypress
Copy link

cypress bot commented Mar 3, 2026

codap-v3    Run #10482

Run Properties:  status check passed Passed #10482  •  git commit 9c89ff86d9: Increment the build number
Project codap-v3
Branch Review main
Run status status check passed Passed #10482
Run duration 02m 22s
Commit git commit 9c89ff86d9: Increment the build number
Committer github-actions[bot]
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
View all changes introduced in this branch ↗︎

@kswenson kswenson requested a review from tealefristoe March 3, 2026 20:46
@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.31%. Comparing base (716aa18) to head (26d51b7).
⚠️ Report is 3 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (716aa18) and HEAD (26d51b7). Click for more details.

HEAD has 15 uploads less than BASE
Flag BASE (716aa18) HEAD (26d51b7)
cypress 16 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2440       +/-   ##
===========================================
- Coverage   85.50%   69.31%   -16.19%     
===========================================
  Files         760      760               
  Lines       42273    42274        +1     
  Branches    10341    10063      -278     
===========================================
- Hits        36144    29302     -6842     
- Misses       6114    12966     +6852     
+ Partials       15        6        -9     
Flag Coverage Δ
cypress 39.32% <100.00%> (-29.88%) ⬇️
jest 57.57% <50.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@tealefristoe tealefristoe left a comment

Choose a reason for hiding this comment

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

Looks good 👍

Why use If over {isOpen && ... }?

@kswenson
Copy link
Member Author

kswenson commented Mar 3, 2026

Looks good 👍

Why use If over {isOpen && ... }?

Just readability. The braces, the weird indenting, the switching between JS and JSX all make the && approach less readable. With If, it's straight JSX all the way down. We've/I've standardized on If for conditional rendering in CODAP for a while now.

@kswenson kswenson merged commit 2b9cae8 into main Mar 3, 2026
16 of 17 checks passed
@kswenson kswenson deleted the CODAP-572-fix-axis-submenu-focus branch March 3, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v3 CODAP v3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants