Skip to content

Commit

Permalink
Check if element exists before applying aria attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
dimsemenov committed Nov 22, 2022
1 parent 4a1e744 commit 8d12ccd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/js/slide/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,10 @@ class Content {
} else if (this.isError()) {
this.load(false, true); // try to reload
}
this.slide.holderElement.setAttribute('aria-hidden', 'false');

if (this.slide.holderElement) {
this.slide.holderElement.setAttribute('aria-hidden', 'false');
}
}
}

Expand All @@ -456,7 +459,9 @@ class Content {
*/
deactivate() {
this.instance.dispatch('contentDeactivate', { content: this });
this.slide.holderElement.setAttribute('aria-hidden', 'true');
if (this.slide && this.slide.holderElement) {
this.slide.holderElement.setAttribute('aria-hidden', 'true');
}
}


Expand Down

0 comments on commit 8d12ccd

Please sign in to comment.