Skip to content

Commit

Permalink
improve accessibility in Support page more/less buttons (#596)
Browse files Browse the repository at this point in the history
* improve accessibility to support more/less buttons

* add section header to the aria label of the more/less button
  • Loading branch information
zdeveloper authored Sep 6, 2023
1 parent 664b5fb commit bcbe96d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pages/support.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,25 @@ <h2>Get in touch</h2>
});
const toggleHiddenLinks = (footerElement) => {
const footerText = footerElement.querySelector('.footer-text');
const toggleButton = footerElement.querySelector("button");
const cardElement = footerElement.parentElement;
const bodyElement = cardElement.querySelector('.usa-card__body');
const sectionName = cardElement.querySelector('.usa-card__heading').textContent;
const hiddenLinks = cardElement.querySelectorAll('.hidden-link');
hiddenLinks.forEach(link => {
if (link.classList.contains('display-none')) {
link.classList.remove('display-none');
bodyElement.classList.add('expanded');
animateCSS(link, 'fadeInDown');
footerText.textContent = 'Less';
footerText.setAttribute("aria-label", `see less ${sectionName} related links`)
toggleButton.setAttribute("aria-expanded", true)
} else {
animateCSS(link, 'fadeOutUp');
bodyElement.classList.remove('expanded');
footerText.textContent = 'More';
footerText.setAttribute("aria-label", `see more ${sectionName} related links`)
toggleButton.setAttribute("aria-expanded", false)
}
});
}
Expand Down

0 comments on commit bcbe96d

Please sign in to comment.