Skip to content

Commit

Permalink
feat(a11y): add a11y.slideRole parameter for custom slide role
Browse files Browse the repository at this point in the history
fixes #4435
  • Loading branch information
nolimits4web committed Apr 19, 2021
1 parent fd93913 commit 097109f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/a11y/a11y.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const A11y = {
if (params.itemRoleDescriptionMessage) {
swiper.a11y.addElRoleDescription($(swiper.slides), params.itemRoleDescriptionMessage);
}
swiper.a11y.addElRole($(swiper.slides), 'group');
swiper.a11y.addElRole($(swiper.slides), params.slideRole);
swiper.slides.each((slideEl) => {
const $slideEl = $(slideEl);
const ariaLabelMessage = params.slideLabelMessage
Expand Down Expand Up @@ -267,6 +267,7 @@ export default {
containerMessage: null,
containerRoleDescriptionMessage: null,
itemRoleDescriptionMessage: null,
slideRole: 'group',
},
},
create() {
Expand Down
7 changes: 7 additions & 0 deletions src/types/components/a11y.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,11 @@ export interface A11yOptions {
* @default '{{index}} / {{slidesLength}}'
*/
slideLabelMessage?: string;

/**
* Value of swiper slide `role` attribute
*
* @default 'group'
*/
slideRole?: string;
}

0 comments on commit 097109f

Please sign in to comment.