A11y: normalize Slick carousel ARIA output#5643
Open
accesswatch wants to merge 3 commits into
Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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 withinaria-hiddenregions. - Updates the
az_carousellibrary 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'); |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tugboat has finished building the preview for this pull request! Link: Dashboard: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Issue types targeted
aria-hidden-focusaria-valid-attr-valuearia-required-childrenaria-allowed-attrnested-interactiveChanges
modules/custom/az_carousel/az_carousel.libraries.ymlmodules/custom/az_carousel/js/az_carousel.a11y.js(new)listbox/option/tablistmappings).aria-hidden=trueregions from staying tabbable.init,reInit,afterChange,setPosition,breakpoint).Impact