Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save SteveJonesDev/a83f241baf04c97d38e5756f5078ddec to your computer and use it in GitHub Desktop.

Select an option

Save SteveJonesDev/a83f241baf04c97d38e5756f5078ddec to your computer and use it in GitHub Desktop.
Accessibility: Remove tabindex 0 on Flickity sliders
document.addEventListener('DOMContentLoaded', function () {
function removeFlickityTabindex() {
document.querySelectorAll('.flickity-enabled[tabindex="0"]').forEach(function (slider) {
slider.removeAttribute('tabindex');
});
}
removeFlickityTabindex();
const observer = new MutationObserver(removeFlickityTabindex);
observer.observe(document.body, {
childList: true,
subtree: true,
attributes: true,
attributeFilter: ['tabindex', 'class']
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment