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

Presets Panel: Nested Interactive Elements #5489

Open
derekjackson-das opened this issue Jan 27, 2025 · 0 comments
Open

Presets Panel: Nested Interactive Elements #5489

derekjackson-das opened this issue Jan 27, 2025 · 0 comments
Labels
a11y Accessibility

Comments

@derekjackson-das
Copy link
Collaborator

Issue Description

Each preset is has the role of "option" but also contain more interactive items nested in the option to perform actions like delete or edit. This is not an expected pattern for the role, and many non-visual and low-vision users will not anticipate the nested actions in an "option" object.

WCAG Criteria

1.3.1 Info and Relationships - A

Notes

Separate the different functions of the task into their own interactive elements. The "option" role does not need to be used here because it is typically understood to be part of a select HTML element or a widget with a listbox role, which is not the case for the preset choices.

In addition, the option element should only contain text, so including interactive elements becomes somewhat of an anti-pattern.

One alternative is to have each preset grouped but put the actions into their own interactive elements, e.g., buttons. A very simple example of an alternative UI can be seen here: CodePen Demo.

Screenshot of the accessibility tree in Chrome's devtools showing each preset as a group and the associated actions within the group as individual buttons.

More details about the option role: MDN Option Role.

Screenshot or Screen Recording

Screen shot of the presets panel with one of the presets high-lighted and the corresponding code, listed in the Relevant Code below, with the role='options' attribute circled.

Relevant Code

<div type="button">
  <div
    role="option"
    aria-selected="false"
    aria-label="New Preset:"
    data-testid="preset-item-[object Object]"
    class="group m-1.5 flex cursor-pointer gap-2 rounded px-5 py-2.5 !pr-3 text-sm !opacity-100 hover:bg-black/5 focus:ring-0 radix-disabled:pointer-events-none radix-disabled:opacity-50 dark:hover:bg-gray-600 md:min-w-[240px]"
    tabindex="0"  >
    ...
  </div>
</div>
@derekjackson-das derekjackson-das added the a11y Accessibility label Jan 27, 2025
@derekjackson-das derekjackson-das changed the title Nested Interactive Elements in the Options of the Presets Panel Presets Panel: Nested Interactive Elements in the Options Jan 27, 2025
@derekjackson-das derekjackson-das changed the title Presets Panel: Nested Interactive Elements in the Options Presets Panel: Nested Interactive Elements Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y Accessibility
Projects
None yet
Development

No branches or pull requests

1 participant