Skip to content

fix(a11y): remove role=option from slick carousel slides (nested-interactive WCAG 4.1.2) - #13031

Closed
mekarpeles wants to merge 2 commits into
masterfrom
a11y/slick-nested-interactive
Closed

fix(a11y): remove role=option from slick carousel slides (nested-interactive WCAG 4.1.2)#13031
mekarpeles wants to merge 2 commits into
masterfrom
a11y/slick-nested-interactive

Conversation

@mekarpeles

Copy link
Copy Markdown
Member

Summary

  • Slick carousel adds role="option" + tabindex="-1" to each slide (when accessibility: true, the default).
  • When slides contain links or buttons, this creates nested-interactive violations — role="option" makes the slide an interactive element, and interactive elements cannot contain other interactive elements per WCAG 4.1.2.
  • Home page had 9 violations: 3 from the tutorial carousel, 6 from the category carousel.

Fix: After slick initializes, remove role="option" from all .slick-slide elements. A MutationObserver handles dynamically added slides (the loadMore path). Slick's prev/next keyboard navigation and arrow key support are unaffected — those are driven by the slick-next/slick-prev buttons, not the role="listbox" pattern.

Test plan

  • Visit / — inspect carousel slides: no role="option" attribute.
  • Keyboard tab through home page — prev/next carousel buttons still reachable and functional.
  • Playwright regression test added in 12885/playwright-e2e-tests worktree (see PR test(e2e): add Playwright smoke test suite for core OL pages #12998).
  • Run axe on / — no nested-interactive violations.

Part of WCAG 2.1 AA a11y remediation — tracked in #13009

…1.4.3)

.login-links__secondary renders on the --light-beige app-drawer background.
--primary-blue (hsl 202 96% 37%) against --light-beige (hsl 48 29% 93%)
yields 4.27:1 — below the 4.5:1 AA threshold. --link-blue (hsl 202 96% 28%)
gives 6.51:1 against --light-beige and 7.41:1 against white (hover state).

Fixes the 11 login-links__secondary violations tracked in #13009.
@mekarpeles mekarpeles added the Theme: Accessibility Work related to disability accessibility. [managed] label Jun 24, 2026
mekarpeles added a commit that referenced this pull request Jun 24, 2026
Regression guard for PR #13031: home page carousel slides must not have
role=option (nested-interactive WCAG 4.1.2).

Test currently passes against local env with fix applied.
@mekarpeles
mekarpeles force-pushed the a11y/slick-nested-interactive branch from 333e468 to cf47228 Compare June 24, 2026 20:48
…ractive WCAG 4.1.2)

Slick adds role="option" + tabindex="-1" to each slide when accessibility
mode is on. When slides contain links the combination creates nested-interactive
violations (9 nodes on /: tutorial + category carousels).

Fix: after init, remove role="option" from all slides. A MutationObserver
covers dynamically added slides (the loadMore path). Slick's prev/next
keyboard navigation is unaffected.

Fixes #13009 (WCAG 4.1.2 nested-interactive on home page).
@mekarpeles
mekarpeles force-pushed the a11y/slick-nested-interactive branch from cf47228 to fbdb19a Compare June 24, 2026 20:49

@lokesh lokesh left a comment

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.

Blocking

  • static/css/components/header-bar.css:187-188 — This login-links color change (--primary-blue--link-blue) isn't part of the carousel a11y fix. Let's pull it out so this PR stays focused on the one thing. Happy to see it land on its own.

Non-blocking

  • Carousel.js:95-102 — The observer filters on role and the handler calls removeAttr('role'), so each removal re-fires the observer. It terminates right away (nothing left to remove), so no loop, but it's an extra pass every time. Minor, fine to leave.

Nits

  • Carousel.js — Worth a one-line note in the PR body that this is interim: when ol-carousel lands it should own the presentational roles from the start so we don't reintroduce the nested-interactive pattern.

Tested locally before merging? If yes and CI is green, this looks ready.

@lokesh

lokesh commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Closing as we are building out our own carousel component. Additional work on Slick carousel should be limited.

Please reopen if you think this is worth investing in.

@lokesh lokesh closed this Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Theme: Accessibility Work related to disability accessibility. [managed]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants