Skip to content

Instantly share code, notes, and snippets.

@landbryo
Created December 12, 2019 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save landbryo/a2a0c4577ec15a545109e180a9e4de2f to your computer and use it in GitHub Desktop.
Save landbryo/a2a0c4577ec15a545109e180a9e4de2f to your computer and use it in GitHub Desktop.
The Beaver Builder Power Pack Post Grid has empty links which are flagged for accessibility. This function maps the post's title to an aria label.
function ppPostAria() {
let links = document.querySelectorAll('.pp-post-link');
let titles = document.querySelectorAll('.pp-content-grid-title');
for (let i = 0; i < links.length; i++) {
let title = titles[i].innerText;
links[i].setAttribute('aria-label', title);
}
}
if (document.querySelectorAll('.pp-content-post-grid').length !== 0) {
ppPostAria();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment