Skip to content

A11y: normalize Slick carousel ARIA output#5643

Open
accesswatch wants to merge 3 commits into
mainfrom
accessibility-fixes-carousel-aria
Open

A11y: normalize Slick carousel ARIA output#5643
accesswatch wants to merge 3 commits into
mainfrom
accessibility-fixes-carousel-aria

Conversation

@accesswatch
Copy link
Copy Markdown
Contributor

Summary

  • Remediates remaining Slick-carousel ARIA patterns that were driving CSV findings.
  • Normalizes generated markup after Slick renders so semantics stay valid for assistive tech and scanners.

Issue types targeted

  • aria-hidden-focus
  • aria-valid-attr-value
  • aria-required-children
  • aria-allowed-attr
  • nested-interactive

Changes

  1. modules/custom/az_carousel/az_carousel.libraries.yml
    • Adds new JS behavior and required dependencies.
  2. modules/custom/az_carousel/js/az_carousel.a11y.js (new)
    • Removes incompatible ARIA widget roles/attributes emitted by Slick (listbox/option/tablist mappings).
    • Normalizes dot navigation semantics to native list + button behavior.
    • Prevents focusable descendants within aria-hidden=true regions from staying tabbable.
    • Re-runs normalization on Slick lifecycle events (init, reInit, afterChange, setPosition, breakpoint).

Impact

  • Impacted files: 2
  • Scope: focused carousel-output hardening; no content model changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 28, 2026 01:32
@accesswatch accesswatch requested review from a team as code owners May 28, 2026 01:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a Drupal behavior to post-process Slick carousel markup to normalize ARIA/focus semantics for improved accessibility and reduced automated scanner findings.

Changes:

  • Adds a new JS behavior (az_carousel.a11y.js) that removes certain Slick-emitted ARIA roles/attributes and manages tab focus within aria-hidden regions.
  • Updates the az_carousel library definition to include the new JS file and required core dependencies.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
modules/custom/az_carousel/js/az_carousel.a11y.js Introduces DOM normalization logic for Slick ARIA patterns and focusability in hidden regions, re-running on Slick lifecycle events.
modules/custom/az_carousel/az_carousel.libraries.yml Registers the new a11y JS behavior and adds core/drupal, core/jquery, and core/once dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +23 to +25
carousel.querySelectorAll('[aria-hidden="true"] a, [aria-hidden="true"] button, [aria-hidden="true"] input, [aria-hidden="true"] select, [aria-hidden="true"] textarea, [aria-hidden="true"] [tabindex]').forEach((focusable) => {
focusable.setAttribute('tabindex', '-1');
});
Comment on lines +24 to +28
focusable.setAttribute('tabindex', '-1');
});

carousel.querySelectorAll('[aria-hidden="false"] a[tabindex="-1"], [aria-hidden="false"] button[tabindex="-1"], [aria-hidden="false"] input[tabindex="-1"], [aria-hidden="false"] select[tabindex="-1"], [aria-hidden="false"] textarea[tabindex="-1"], [aria-hidden="false"] [tabindex="-1"]').forEach((focusable) => {
focusable.removeAttribute('tabindex');
accesswatch and others added 2 commits May 27, 2026 18:50
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@az-digital-bot
Copy link
Copy Markdown
Contributor

Tugboat has finished building the preview for this pull request!

Link:

Dashboard:

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