Skip to content

[WC-3418] Combobox accessibility improvements#2281

Open
HedwigAR wants to merge 12 commits into
mainfrom
feature/combobox-validation-improvements
Open

[WC-3418] Combobox accessibility improvements#2281
HedwigAR wants to merge 12 commits into
mainfrom
feature/combobox-validation-improvements

Conversation

@HedwigAR

Copy link
Copy Markdown
Contributor

Pull request type

Bug fix (non-breaking change which fixes an issue)


Description

Fixes two WCAG accessibility violations in the combobox widget.

  1. Decorative icons hidden from screen readers: Added aria-hidden="true" to DownArrow and ClearButton icon wrappers to prevent "image" announcements
  2. Empty menu structures removed from accessibility tree: Menu <ul> now only renders when open, preventing screen readers from navigating to empty groups

What should be covered while testing?

Screen Reader Testing:

  • Verify decorative icons (arrow, clear button) are NOT announced as "image"
  • Verify no empty list structures when menu is closed
  • Verify clear button announces with proper label text

Functional Testing:

  • Test keyboard navigation (Tab, Enter, Arrow keys, Escape)
  • Test single and multi-selection modes
  • Verify validation attributes (aria-invalid, aria-describedby) still work

@HedwigAR
HedwigAR requested a review from a team as a code owner June 19, 2026 10:41
@HedwigAR HedwigAR changed the title Combobox accessibility improvements [WC-3418] Combobox accessibility improvements Jun 19, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@HedwigAR
HedwigAR force-pushed the feature/combobox-validation-improvements branch from 0d5657e to d1fded1 Compare July 6, 2026 13:40
@github-actions

This comment has been minimized.

Comment on lines +144 to +153
aria-label={
!isOpen && selectedItems.length > 0 && hasLabel
? `${labelText}, ${selectedItems.map(id => selector.caption.get(id)).join(", ")}`
: !isOpen && selectedItems.length > 0
? selectedItems.map(id => selector.caption.get(id)).join(", ")
: !hasLabel
? options.ariaLabel
: undefined
}
aria-labelledby={hasLabel && isOpen ? inputProps["aria-labelledby"] : undefined}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I believe we better create a helper function that covers this, also as AI review mentioned, there is a logic error where in empty it will have no label at all, we should address this in a helper function that we can unit test.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

+1


await waitFor(() => {
const spinner = component.container.querySelector(".widget-combobox-spinner");
if (spinner) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@leonardomendix, can we avoid this if? How do you think?

placeholder=" "
aria-labelledby={hasLabel ? inputProps["aria-labelledby"] : undefined}
aria-label={
!isOpen && selectedItem && hasLabel

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also case for helper function

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@HedwigAR
HedwigAR force-pushed the feature/combobox-validation-improvements branch from a14d634 to 093bcff Compare July 16, 2026 13:32
@github-actions

This comment has been minimized.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants