Created
December 12, 2019 19:01
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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