Skip to content
Merged
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
13 changes: 13 additions & 0 deletions src/modules/A11yFacetWP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export class A11yFacetWP {
* This timeout is necessary because otherwise it will be called too early
*/
setTimeout( () => {
this.removeRoleNavigationFromPager();
this.addAriaCurrentToPager();
this.changeAriaLabelSelections();
}, 1 );
Expand Down Expand Up @@ -96,6 +97,18 @@ export class A11yFacetWP {
}
}

/**
* A11y: remove 'role=navigation' from FacetWP pager if it is inside a <nav> element.
*/
private removeRoleNavigationFromPager(): void {
const pager = document.querySelector( '.facetwp-pager' );
if ( ! pager ) return;

if ( pager.parentElement?.tagName.toLowerCase() === 'nav' ) {
pager.removeAttribute( 'role' );
}
}

Comment on lines +100 to +111
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ahh right hier had je JS nodig omdat facetwp zelf die "role" zette. Helder.

/**
* A11y: add 'aria-current' attribute to FacetWP pager.
*/
Expand Down