Skip to content

Commit 6a1ec08

Browse files
author
Rafael J. Staib
committed
Add aria-busy for async loading and add a bugfix
1 parent 3a4aab0 commit 6a1ec08

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

jquery.steps.js

+16-11
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
*
2121
* Planed Features:
2222
* - Progress bar
23-
* - Advanced Accessibility support (WAI-ARIA)
2423
* - Implement preloadContent for async and iframe content types.
2524
* - Implement functionality to skip a certain amount of steps
2625
* - Dynamic settings change (setOptions({ enablePagination: false }))
@@ -286,6 +285,7 @@
286285
* @type Boolean
287286
* @default false
288287
* @for defaults
288+
* @since 0.9.4
289289
**/
290290
autoFocus: false,
291291

@@ -766,10 +766,16 @@
766766
transformBody(wizard, body, index);
767767
transformTitle(wizard, header, index);
768768

769+
var currentStep = $("li[role=tab]:eq(" + index + ")", wizard);
770+
if (state.currentIndex > index)
771+
{
772+
currentStep.removeClass("disabled").attr("aria-disabled", "false").addClass("done");
773+
}
774+
769775
state.currentStep = getStepProperties(wizard, state.currentIndex);
770776

771777
// Add click event
772-
$("li[role=tab]:eq(" + index + ") > a", wizard).bind("click.steps", stepClickHandler);
778+
currentStep.children("a").bind("click.steps", stepClickHandler);
773779

774780
updateSteps(wizard, index);
775781
refreshActionState(wizard);
@@ -1034,13 +1040,7 @@
10341040

10351041
if (index < startIndex)
10361042
{
1037-
$("li[role=tab]:eq(" + index + ")", wizard).addClass("done");
1038-
}
1039-
1040-
if (index > startIndex && !options.enableAllSteps)
1041-
{
1042-
$("li[role=tab]:eq(" + index + ")", wizard).addClass("disabled")
1043-
.attr("aria-disabled", "true");
1043+
$("li[role=tab]:eq(" + index + ")", wizard).removeClass("disabled").attr("aria-disabled", "false").addClass("done");
10441044
}
10451045
});
10461046

@@ -1116,6 +1116,11 @@
11161116
}),
11171117
stepItem = $("<li role=\"tab\"><a id=\"" + uniqueStepId + "\" href=\"#" + uniqueHeaderId +
11181118
"\" aria-controls=\"" + uniqueBodyId + "\">" + title + "</a></li>");
1119+
1120+
if (!options.enableAllSteps)
1121+
{
1122+
stepItem.addClass("disabled").attr("aria-disabled", "true");
1123+
}
11191124

11201125
header.attr("id", uniqueHeaderId).attr("tabindex", "-1").addClass("title");
11211126

@@ -1165,12 +1170,12 @@
11651170
break;
11661171

11671172
case $.fn.steps.contentMode.async:
1168-
var currentStepContent = $(".content > .body", wizard).eq(state.currentIndex)
1173+
var currentStepContent = $(".content > .body", wizard).eq(state.currentIndex).attr("aria-busy", "true")
11691174
.empty().append(renderTemplate(options.loadingTemplate, { text: options.labels.loading }));
11701175
$.ajax({ url: state.currentStep.contentUrl, cache: false })
11711176
.done(function (data)
11721177
{
1173-
currentStepContent.empty().html(data).data("loaded", "1");
1178+
currentStepContent.empty().html(data).attr("aria-busy", "false").data("loaded", "1");
11741179
});
11751180
break;
11761181
}

0 commit comments

Comments
 (0)