Skip to content
Snippets Groups Projects

Issue #3380847: Evolve aria_current, streamline dependencies, widen use cases

5 files
+ 52
43
Compare changes
  • Side-by-side
  • Inline
Files
5
(function ($, Drupal) {
Drupal.behaviors.ariaCurrentLinks = {
attach: function attach(context) {
var activeLinks = context.querySelectorAll('nav a.is-active');
var il = activeLinks.length;
for (var i = 0; i < il; i++) {
activeLinks[i].setAttribute('aria-current', 'page');
}
},
detach: function detach(context, settings, trigger) {
if (trigger === 'unload') {
var activeLinks = context.querySelectorAll('a[aria-current="page"]');
var il = activeLinks.length;
for (var i = 0; i < il; i++) {
activeLinks[i].removeAttribute('aria-current');
}
}
}
};
})(jQuery, Drupal);
Loading