ic-ui-kit icon indicating copy to clipboard operation
ic-ui-kit copied to clipboard

[ic-search-bar] a11y violations

Open MI6-286 opened this issue 1 year ago • 2 comments

Summary of the bug

E2E a11y testing on ic-search-bar has shown critical violations. A ticket (#1939) already exists for an aria-allowed-attribute accessibility violation for ic-search-bar/ic-select, but creating more a11y tests for ic-search-bar has revealed further violations: aria-required-attribute and aria-valid-attribute (see below).

🪜 How to reproduce

Uncomment the commented out a11y tests in the ic-search-bar Cypress tests and run tests. See the errors.

To see the aria-required-attribute and aria-valid-attribute errors specifically, run the following tests: "should render search bar with options - no filtering" "should render search bar with custom empty option list text" "should render search bar with characters until suggestion set - no show" "should render search bar with characters until suggestion set - show" "should render search bar with long option labels"

📸 Screenshots or code

image

🖥 📱 Device

  • Type: Cypress a11y testing

🧐 Expected behaviour

All a11y tests should pass. To check this please uncomment the a11y tests in the ic-search-bar Cypress tests.

MI6-286 avatar Jun 17 '24 15:06 MI6-286

Looks like its complaining about not having aria-controls and complaining about having aria-owns so is it not just changing this line - aria-owns={menuRendered ? menuId : undefined}

MI6-255 avatar Aug 15 '24 09:08 MI6-255

These issues and similar ones have been seen before. Some useful links for context around aria, ids and shadow-dom:

  • https://nolanlawson.com/2022/11/28/shadow-dom-and-accessibility-the-trouble-with-aria/
  • https://caniuse.com/?search=ariaControlsElements

Previous PR for reference

GCHQ-Developer-741 avatar Oct 08 '24 08:10 GCHQ-Developer-741

issue seems to be caused by the aria-owns & aria-controls being set on the <input> element inside the shadowDom of ic-text-field, which cannot refer to the ic-menu

ad9242 avatar Dec 31 '24 14:12 ad9242