Skip to content

Instantly share code, notes, and snippets.

@dislokacia
Created July 19, 2022 21:23
Show Gist options
  • Save dislokacia/b44790c16fadbeec161238180fb19eb6 to your computer and use it in GitHub Desktop.
Save dislokacia/b44790c16fadbeec161238180fb19eb6 to your computer and use it in GitHub Desktop.
Accessible jet-pagination
jQuery(document).ready(function( $ ){
init();
$( document ).on( 'jet-filter-content-rendered', function() {
setTimeout(function() {
init();
$('.jet-filters-pagination__current .jet-filters-pagination__link').attr('aria-pressed', 'true');
}, 1);
});
function init(){
$('.jet-filters-pagination__link').each(function(){
$(this).attr('role', 'button');
$(this).attr('aria-pressed', 'false');
$(this).attr('tabindex', '0');
});
$(".jet-filters-pagination__link").on('keypress',function(e) {
if(e.which === 13 || e.which === " " || e.which === "Spacebar" ) {
$(this).trigger('click');
};
});
};
});
@dislokacia
Copy link
Author

The idea was taken from here

@DeathStapler
Copy link

Have you created anything for the JetSmartFilters checkbox, radio, range, and visual filters? They are not accessible out of the box. Crocoblock just pointed me to this code snippet, which doesn't resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment