Skip to content

Commit 0f34c52

Browse files
Ignore the empty role option so that we can prevent Splide from assigning the role="region". Tweak the i18n string.
1 parent 453ae88 commit 0f34c52

9 files changed

Lines changed: 20 additions & 16 deletions

File tree

dist/js/splide-renderer.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/splide.cjs.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -830,12 +830,13 @@ function Elements(Splide2, Components2, options) {
830830

831831
function init() {
832832
var id = root.id || uniqueId(PROJECT_CODE);
833+
var role = options.role;
833834
root.id = id;
834835
track.id = track.id || id + "-track";
835836
list.id = list.id || id + "-list";
836837

837-
if (!getAttribute(root, ROLE)) {
838-
setAttribute(root, ROLE, root.tagName !== "SECTION" && options.role || "");
838+
if (!getAttribute(root, ROLE) && root.tagName !== "SECTION" && role) {
839+
setAttribute(root, ROLE, role);
839840
}
840841

841842
setAttribute(root, ARIA_ROLEDESCRIPTION, i18n.carousel);
@@ -2805,7 +2806,7 @@ var I18N = {
28052806
pause: "Pause autoplay",
28062807
carousel: "carousel",
28072808
slide: "slide",
2808-
select: "Select slide to show",
2809+
select: "Select a slide to show",
28092810
slideLabel: "%s of %s"
28102811
};
28112812
var DEFAULTS = {

dist/js/splide.esm.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -825,12 +825,13 @@ function Elements(Splide2, Components2, options) {
825825

826826
function init() {
827827
var id = root.id || uniqueId(PROJECT_CODE);
828+
var role = options.role;
828829
root.id = id;
829830
track.id = track.id || id + "-track";
830831
list.id = list.id || id + "-list";
831832

832-
if (!getAttribute(root, ROLE)) {
833-
setAttribute(root, ROLE, root.tagName !== "SECTION" && options.role || "");
833+
if (!getAttribute(root, ROLE) && root.tagName !== "SECTION" && role) {
834+
setAttribute(root, ROLE, role);
834835
}
835836

836837
setAttribute(root, ARIA_ROLEDESCRIPTION, i18n.carousel);
@@ -2800,7 +2801,7 @@ var I18N = {
28002801
pause: "Pause autoplay",
28012802
carousel: "carousel",
28022803
slide: "slide",
2803-
select: "Select slide to show",
2804+
select: "Select a slide to show",
28042805
slideLabel: "%s of %s"
28052806
};
28062807
var DEFAULTS = {

dist/js/splide.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -824,12 +824,13 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
824824

825825
function init() {
826826
var id = root.id || uniqueId(PROJECT_CODE);
827+
var role = options.role;
827828
root.id = id;
828829
track.id = track.id || id + "-track";
829830
list.id = list.id || id + "-list";
830831

831-
if (!getAttribute(root, ROLE)) {
832-
setAttribute(root, ROLE, root.tagName !== "SECTION" && options.role || "");
832+
if (!getAttribute(root, ROLE) && root.tagName !== "SECTION" && role) {
833+
setAttribute(root, ROLE, role);
833834
}
834835

835836
setAttribute(root, ARIA_ROLEDESCRIPTION, i18n.carousel);
@@ -2799,7 +2800,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
27992800
pause: "Pause autoplay",
28002801
carousel: "carousel",
28012802
slide: "slide",
2802-
select: "Select slide to show",
2803+
select: "Select a slide to show",
28032804
slideLabel: "%s of %s"
28042805
};
28052806
var DEFAULTS = {

dist/js/splide.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/splide.min.js.gz

10 Bytes
Binary file not shown.

dist/js/splide.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/js/components/Elements/Elements.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,15 @@ export function Elements( Splide: Splide, Components: Components, options: Optio
201201
* which removes the region from the accessibility tree.
202202
*/
203203
function init(): void {
204-
const id = root.id || uniqueId( PROJECT_CODE );
204+
const id = root.id || uniqueId( PROJECT_CODE );
205+
const role = options.role;
205206

206207
root.id = id;
207208
track.id = track.id || `${ id }-track`;
208209
list.id = list.id || `${ id }-list`;
209210

210-
if ( ! getAttribute( root, ROLE ) ) {
211-
setAttribute( root, ROLE, root.tagName !== 'SECTION' && options.role || '' );
211+
if ( ! getAttribute( root, ROLE ) && root.tagName !== 'SECTION' && role ) {
212+
setAttribute( root, ROLE, role );
212213
}
213214

214215
setAttribute( root, ARIA_ROLEDESCRIPTION, i18n.carousel );

src/js/constants/i18n.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ export const I18N = {
1414
pause : 'Pause autoplay',
1515
carousel : 'carousel',
1616
slide : 'slide',
17-
select : 'Select slide to show',
17+
select : 'Select a slide to show',
1818
slideLabel: '%s of %s', // [ slide number ] / [ slide size ]
1919
};

0 commit comments

Comments
 (0)