Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(menu): prevents defaultFocusedValue on trigger click #660

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

geotrev
Copy link
Contributor

@geotrev geotrev commented Sep 12, 2024

Description

Currently, setting a defaultFocusedValue causes unexpected focus into the menu when the trigger is clicked with a mouse.

Detail

The way defaultFocusedValue should operate today is to only focus an item when the menu opens with keyboard interaction (from the trigger).

Instead, because useReducer initializes with defaultFocusedValue, a menu first opens with that value selected, including mouse interaction.

This behavior is intended to match APG examples which prefer moving focus into menus only when an item is hovered.

Note the below demonstration that showcases Hydrangea as the default focused value before and after the fix.

Before:

Screen.Recording.2024-09-12.at.12.28.50.PM.mov

After:

Screen.Recording.2024-09-12.at.12.34.38.PM.mov

Checklist

  • 🌐 demo is up-to-date (npm start)
  • 💂‍♂️ includes new unit tests
  • ♿ tested for WCAG 2.1 AA compliance
  • 📝 tested in Chrome, Firefox, Safari, and Edge

@geotrev geotrev requested a review from a team as a code owner September 12, 2024 17:39
@geotrev geotrev changed the title fix(menu): prevents defaultFocusedValue on trigger click fix(menu): prevents defaultFocusedValue on trigger click Sep 12, 2024
@geotrev geotrev force-pushed the george/menu-default-value-fix branch from e2079ce to ef2cc59 Compare September 12, 2024 17:42
@coveralls
Copy link

coveralls commented Sep 12, 2024

Coverage Status

coverage: 95.716% (-0.003%) from 95.719%
when pulling cd668dd on george/menu-default-value-fix
into 482fbf0 on main.

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

Successfully merging this pull request may close these issues.

4 participants