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

nimble-menu-item checkbox support #2311

Open
fredvisser opened this issue Jul 30, 2024 · 2 comments
Open

nimble-menu-item checkbox support #2311

fredvisser opened this issue Jul 30, 2024 · 2 comments
Labels
enhancement New feature or request ozone

Comments

@fredvisser
Copy link
Contributor

💡 New Component

😯 Problem to Solve

The nimble-menu-button is often used to contain check/selectable items, but today we simply insert a check icon into the nimble-menu-item to style it as selected.

In doing so, we neglect the correct ARIA role="menuitemcheckbox" and require our clients to manage this state.

Screenshot 2024-07-30 at 3 14 41 PM

💁 Proposed Solution

The existing FAST component already supports (Supports fast-menu-item elements or elements with a role of 'menuitem', 'menuitemcheckbox', and 'menuitemradio'").

Perhaps we document that role="menuitemcheckbox" is valid for nimble-menu-item, and style the menu-item to automatically add the checkbox icon when the item is checked?

@fredvisser fredvisser added enhancement New feature or request triage New issue that needs to be reviewed labels Jul 30, 2024
@rajsite
Copy link
Member

rajsite commented Jul 30, 2024

Supports fast-menu-item elements or elements with a role of 'menuitem', 'menuitemcheckbox', and 'menuitemradio'"

Wild didn't realize that was part of the template. We probably want an HLD. At first glance I'd say having separate elements like nimble-checkbox-menu-item would be more inline with our api as it allows you to:

  1. Only pay the cost of the checkbox / radio assets if you use them
  2. API-wise avoids having users need to config aria values manually
  3. Inline with how we have done other components (like anchor variations of menu-item, tree-item, etc.)

There could be an argument to use what fast gives but my suspicion is it'll be messier to try and share checkbox / radio styles consistently, but maybe not! HLD / prototype would be nice.

@jattasNI
Copy link
Contributor

jattasNI commented Aug 2, 2024

Some more questions from team discussion:

  1. what automatic work should this do for indenting menu items to reserve space for icons (even non-checkable items that are next to checkable ones)?
  2. how does the client prevent the menu from closing when a checkable item is clicked (this is recommended by ARIA)? This is related to Address MenuButton issues with beforetoggle event #1157 (comment) but needs more discussion about the right solution, what should be automatic, what order events should fire, etc

@m-akinc m-akinc changed the title nimble-menu-item checkbox role support nimble-menu-item checkbox support Aug 6, 2024
@m-akinc m-akinc removed the triage New issue that needs to be reviewed label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ozone
Projects
Status: Backlog
Development

No branches or pull requests

4 participants