Skip to content

Commit

Permalink
fix(plugin): fix issue with aria-hidden visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
ericrallen committed May 19, 2019
1 parent a7a728a commit b3a2c38
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
14 changes: 3 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions plugins/aria-visualizer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,16 @@ class AriaVisualizer extends Plugin {
}

startAriaHidden(attribute) {
const ariaName = `aria-${attribute}`;

[...document.querySelectorAll(`[${ariaName}="true"]:not(.tota11y)`)].forEach((element) => {
[...document.querySelectorAll(`[${attribute}="true"]:not(.tota11y)`)].forEach((element) => {
console.log(element);
if (!element.closest(".tota11y")) {
element.classList.add(`tota11y-${ariaName}-visualized`);
element.classList.add(`tota11y-${attribute}-visualized`);
}
});
}

stopAriaHidden(attribute) {
const ariaName = `aria-${attribute}`;

const className = `tota11y-${ariaName}-visualized`;
const className = `tota11y-${attribute}-visualized`;

[...document.querySelectorAll(`.${className}`)].forEach((element) => {
element.classList.remove(className);
Expand Down
4 changes: 2 additions & 2 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ <h1>Hello, world!</h1>

<article id="article">
<p>This paragraph is visible.</p>
<p id="p-with-hidden">This paragraph has a <span id="span" aria-hidden="true">hidden</span> span.</p>
<p id="hidden-p" aria-hidden="true">This paragraph is hidden.</p>
<p id="p-with-hidden">This paragraph has an <span id="span" aria-hidden="true">aria-hidden</span> span.</p>
<p id="hidden-p" aria-hidden="true">This paragraph is aria-hidden.</p>
</article>

<p>
Expand Down

0 comments on commit b3a2c38

Please sign in to comment.