Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions themes/custom/az_barrio/az_barrio.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,17 @@ toasts:
dependencies:
- core/drupal
- az_barrio/arizona-bootstrap-js

az-slick-a11y-patch:
js:
js/slick-a11y-patch.js: {}
dependencies:
- core/jquery
- core/drupal

az-slick-a11y-patch:
js:
js/slick-a11y-patch.js: {}
dependencies:
- core/jquery
- core/drupal
Comment on lines +86 to +92
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

az-slick-a11y-patch is defined twice in this YAML. Duplicate keys are invalid YAML and can lead to parsing errors or unexpected overrides (only the last definition may win). Remove the duplicate entry, and (since the JS uses once() semantics) add the appropriate dependency (likely core/once) to the remaining library definition.

Suggested change
az-slick-a11y-patch:
js:
js/slick-a11y-patch.js: {}
dependencies:
- core/jquery
- core/drupal
- core/once

Copilot uses AI. Check for mistakes.
37 changes: 37 additions & 0 deletions themes/custom/az_barrio/js/slick-a11y-patch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Accessibility runtime patch for Slick carousel (short-term fix for #5514)
// - Adjust roles on dot navigation
// - Add aria-label to track
// - Prevent focusable elements inside aria-hidden slides
(function ($, Drupal) {

Check warning on line 5 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L5

[func-names] Unexpected unnamed function.

Check warning on line 5 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L5

[no-unused-vars] 'Drupal' is defined but never used.
'use strict';

Check failure on line 6 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L6

[strict] 'use strict' is unnecessary inside of modules.

Check failure on line 6 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L6

[lines-around-directive] Expected newline after "use strict" directive.
$(document).once('slick-a11y-patch').each(function () {

Check failure on line 7 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L7

[prettier/prettier] Replace `.once('slick-a11y-patch')` with `⏎····.once('slick-a11y-patch')⏎····`

Check warning on line 7 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L7

[func-names] Unexpected unnamed function.
// When slick initializes, apply corrections

Check failure on line 8 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L8

[prettier/prettier] Insert `··`
$(document).on('init reInit', '.slick-slider', function (event, slick) {

Check failure on line 9 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L9

[prettier/prettier] Replace `····` with `······`

Check warning on line 9 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L9

[func-names] Unexpected unnamed function.

Check warning on line 9 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L9

[no-unused-vars] 'event' is defined but never used.

Check warning on line 9 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L9

[no-unused-vars] 'slick' is defined but never used.
var $slider = $(this);

Check failure on line 10 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L10

[prettier/prettier] Insert `··`

Check failure on line 10 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L10

[no-var] Unexpected var, use let or const instead.
// ensure track has accessible name

Check failure on line 11 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L11

[prettier/prettier] Replace `······` with `········`
var $track = $slider.find('.slick-track');

Check failure on line 12 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L12

[prettier/prettier] Insert `··`

Check failure on line 12 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L12

[no-var] Unexpected var, use let or const instead.
if ($track.length && !$track.attr('aria-label')) {

Check failure on line 13 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L13

[prettier/prettier] Insert `··`
$track.attr('aria-label', $slider.data('a11y-label') || 'Carousel slides');

Check failure on line 14 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L14

[prettier/prettier] Replace `$track.attr('aria-label',·$slider.data('a11y-label')·||·'Carousel·slides'` with `··$track.attr(⏎············'aria-label',⏎············$slider.data('a11y-label')·||·'Carousel·slides',⏎··········`
}

Check failure on line 15 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L15

[prettier/prettier] Insert `··`
// fix dots role

Check failure on line 16 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L16

[prettier/prettier] Insert `··`
var $dots = $slider.find('.slick-dots');

Check failure on line 17 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L17

[prettier/prettier] Insert `··`

Check failure on line 17 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L17

[vars-on-top] All 'var' declarations must be at the top of the function scope.

Check failure on line 17 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L17

[no-var] Unexpected var, use let or const instead.
if ($dots.length) {

Check failure on line 18 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L18

[prettier/prettier] Insert `··`
$dots.attr('role', 'list');

Check failure on line 19 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L19

[prettier/prettier] Insert `··`
$dots.find('li').each(function (i) {

Check failure on line 20 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L20

[prettier/prettier] Replace `········` with `··········`

Check warning on line 20 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L20

[func-names] Unexpected unnamed function.
$(this).removeAttr('role aria-selected aria-controls');

Check failure on line 21 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L21

[prettier/prettier] Insert `··`
// ensure internal button has accessible label

Check failure on line 22 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L22

[prettier/prettier] Replace `··········` with `············`
var $btn = $(this).find('button');

Check failure on line 23 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L23

[prettier/prettier] Insert `··`

Check failure on line 23 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L23

[vars-on-top] All 'var' declarations must be at the top of the function scope.

Check failure on line 23 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L23

[no-var] Unexpected var, use let or const instead.
if ($btn.length && !$btn.attr('aria-label')) {

Check failure on line 24 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L24

[prettier/prettier] Replace `··········` with `············`
$btn.attr('aria-label', 'Go to slide ' + (i+1));

Check failure on line 25 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L25

[prettier/prettier] Replace `$btn.attr('aria-label',·'Go·to·slide·'·+·(i+` with `··$btn.attr('aria-label',·'Go·to·slide·'·+·(i·+·`

Check failure on line 25 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L25

[prefer-template] Unexpected string concatenation.
}

Check failure on line 26 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L26

[prettier/prettier] Insert `··`
});

Check warning on line 27 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L20-L27

[max-nested-callbacks] Too many nested callbacks (4). Maximum allowed is 3.

Check failure on line 27 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L27

[prettier/prettier] Replace `········` with `··········`
Comment on lines +16 to +27
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

The dot-nav li elements commonly have aria-hidden set by Slick (and contain focusable <button> children), which is one of the core aria-hidden-focus violations described in #5514. This patch removes role/aria-selected/aria-controls from the li, but it leaves aria-hidden in place and doesn’t adjust the nested button focusability, so the aria-hidden-focus violation may still remain for dots. Consider removing aria-hidden from dot li elements (or otherwise ensuring their buttons are not focusable when hidden).

Copilot uses AI. Check for mistakes.
}

Check failure on line 28 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L28

[prettier/prettier] Insert `··`
// hide focusable children of aria-hidden slides

Check failure on line 29 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L29

[prettier/prettier] Replace `······` with `········`
$slider.find('.slick-slide[aria-hidden="true"]').each(function () {

Check failure on line 30 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L30

[prettier/prettier] Insert `··`

Check warning on line 30 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L30

[func-names] Unexpected unnamed function.
$(this).find('a, button, input, select, textarea').attr('tabindex', '-1');

Check failure on line 31 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L31

[prettier/prettier] Replace `$(this).find('a,·button,·input,·select,·textarea')` with `··$(this)⏎············.find('a,·button,·input,·select,·textarea')⏎············`
});

Check warning on line 32 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L30-L32

[max-nested-callbacks] Too many nested callbacks (4). Maximum allowed is 3.

Check failure on line 32 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L32

[prettier/prettier] Insert `··`
Comment on lines +29 to +32
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

The patch sets tabindex="-1" on focusable elements in aria-hidden="true" slides, but it never restores the original tabindex when a slide becomes visible again. After the first slide change, previously-hidden slides can remain unfocusable even when active. Consider also handling Slick’s slide-change events (e.g., afterChange) and restoring tabindex (ideally only removing/undoing tabindex values that this patch added).

Copilot uses AI. Check for mistakes.
// remove problematic role on slide wrapper

Check failure on line 33 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L33

[prettier/prettier] Insert `··`
$slider.find('.slick-slide').removeAttr('role tabindex');

Check failure on line 34 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L34

[prettier/prettier] Insert `··`
});

Check failure on line 35 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L35

[prettier/prettier] Insert `··`
});

Check failure on line 36 in themes/custom/az_barrio/js/slick-a11y-patch.js

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

themes/custom/az_barrio/js/slick-a11y-patch.js#L36

[prettier/prettier] Insert `··`
})(jQuery, Drupal);
Comment on lines +5 to +37
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

$(document).once(...) relies on the old jQuery Once plugin, which isn’t available by default in Drupal core 11 (core provides the once() utility via core/once). As written, this will likely throw $(...).once is not a function at runtime. Update this to use once() (and/or a Drupal behavior) and ensure the library depends on core/once.

Suggested change
(function ($, Drupal) {
'use strict';
$(document).once('slick-a11y-patch').each(function () {
// When slick initializes, apply corrections
$(document).on('init reInit', '.slick-slider', function (event, slick) {
var $slider = $(this);
// ensure track has accessible name
var $track = $slider.find('.slick-track');
if ($track.length && !$track.attr('aria-label')) {
$track.attr('aria-label', $slider.data('a11y-label') || 'Carousel slides');
}
// fix dots role
var $dots = $slider.find('.slick-dots');
if ($dots.length) {
$dots.attr('role', 'list');
$dots.find('li').each(function (i) {
$(this).removeAttr('role aria-selected aria-controls');
// ensure internal button has accessible label
var $btn = $(this).find('button');
if ($btn.length && !$btn.attr('aria-label')) {
$btn.attr('aria-label', 'Go to slide ' + (i+1));
}
});
}
// hide focusable children of aria-hidden slides
$slider.find('.slick-slide[aria-hidden="true"]').each(function () {
$(this).find('a, button, input, select, textarea').attr('tabindex', '-1');
});
// remove problematic role on slide wrapper
$slider.find('.slick-slide').removeAttr('role tabindex');
});
});
})(jQuery, Drupal);
(function ($, Drupal, once) {
'use strict';
Drupal.behaviors.slickA11yPatch = {
attach: function (context) {
once('slick-a11y-patch', document).forEach(function () {
// When slick initializes, apply corrections
$(document).on('init reInit', '.slick-slider', function (event, slick) {
var $slider = $(this);
// ensure track has accessible name
var $track = $slider.find('.slick-track');
if ($track.length && !$track.attr('aria-label')) {
$track.attr('aria-label', $slider.data('a11y-label') || 'Carousel slides');
}
// fix dots role
var $dots = $slider.find('.slick-dots');
if ($dots.length) {
$dots.attr('role', 'list');
$dots.find('li').each(function (i) {
$(this).removeAttr('role aria-selected aria-controls');
// ensure internal button has accessible label
var $btn = $(this).find('button');
if ($btn.length && !$btn.attr('aria-label')) {
$btn.attr('aria-label', 'Go to slide ' + (i + 1));
}
});
}
// hide focusable children of aria-hidden slides
$slider.find('.slick-slide[aria-hidden="true"]').each(function () {
$(this).find('a, button, input, select, textarea').attr('tabindex', '-1');
});
// remove problematic role on slide wrapper
$slider.find('.slick-slide').removeAttr('role tabindex');
});
});
}
};
})(jQuery, Drupal, once);

Copilot uses AI. Check for mistakes.
Loading