From 8d12ccd9009a4b4ed78cc200e69abd4bd470b3fe Mon Sep 17 00:00:00 2001 From: Dmytro Semenov Date: Tue, 22 Nov 2022 07:12:56 +0200 Subject: [PATCH] Check if element exists before applying aria attributes --- src/js/slide/content.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/js/slide/content.js b/src/js/slide/content.js index e001fa22..9121f9ac 100644 --- a/src/js/slide/content.js +++ b/src/js/slide/content.js @@ -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'); + } } } @@ -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'); + } }