Skip to content

Commit aa83a03

Browse files
committed
fix(a11y): add notification span to shadow root in Swiper Element
fixes #6634
1 parent 446af7e commit aa83a03

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/modules/a11y/a11y.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,11 @@ export default function A11y({ swiper, extendParams, on }) {
264264
const init = () => {
265265
const params = swiper.params.a11y;
266266

267-
swiper.el.append(liveRegion);
267+
if (swiper.isElement) {
268+
swiper.el.shadowEl.append(liveRegion);
269+
} else {
270+
swiper.el.append(liveRegion);
271+
}
268272

269273
// Container
270274
const containerEl = swiper.el;
@@ -314,7 +318,7 @@ export default function A11y({ swiper, extendParams, on }) {
314318
swiper.el.addEventListener('pointerup', handlePointerUp, true);
315319
};
316320
function destroy() {
317-
if (liveRegion && liveRegion.length > 0) liveRegion.remove();
321+
if (liveRegion) liveRegion.remove();
318322
let { nextEl, prevEl } = swiper.navigation ? swiper.navigation : {};
319323
nextEl = makeElementsArray(nextEl);
320324
prevEl = makeElementsArray(prevEl);
@@ -345,9 +349,6 @@ export default function A11y({ swiper, extendParams, on }) {
345349
liveRegion = createElement('span', swiper.params.a11y.notificationClass);
346350
liveRegion.setAttribute('aria-live', 'assertive');
347351
liveRegion.setAttribute('aria-atomic', 'true');
348-
if (swiper.isElement) {
349-
liveRegion.setAttribute('slot', 'container-end');
350-
}
351352
});
352353

353354
on('afterInit', () => {

0 commit comments

Comments
 (0)