aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.progressbar.js
diff options
context:
space:
mode:
authorDavid Bolter <david.bolter@gmail.com>2008-10-29 16:57:04 +0000
committerDavid Bolter <david.bolter@gmail.com>2008-10-29 16:57:04 +0000
commitb0772dc3d81f00da5d4ce478e36dd5e94649f0d4 (patch)
tree09bdee48225ed6ecd8675b7571b5c376f1d97651 /ui/ui.progressbar.js
parent95980d34da7f4ef6637a107df5fd669c624fd9c6 (diff)
downloadjquery-ui-b0772dc3d81f00da5d4ce478e36dd5e94649f0d4.tar.gz
jquery-ui-b0772dc3d81f00da5d4ce478e36dd5e94649f0d4.zip
added ARIA semantics, and tests.
patch review:scott.gonzalez@gmail.com (fixes bug #3482)
Diffstat (limited to 'ui/ui.progressbar.js')
-rw-r--r--ui/ui.progressbar.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/ui/ui.progressbar.js b/ui/ui.progressbar.js
index a7262e89f..e2266ea68 100644
--- a/ui/ui.progressbar.js
+++ b/ui/ui.progressbar.js
@@ -22,8 +22,14 @@ $.widget("ui.progressbar", {
id = ((new Date()).getTime() + Math.random()),
text = options.text || '0%';
- this.element.addClass("ui-progressbar").width(options.width);
-
+ this.element
+ .addClass("ui-progressbar")
+ .width(options.width)
+ .ariaRole("progressbar")
+ .ariaState("valuemin","0")
+ .ariaState("valuemax","100")
+ .ariaState("valuenow","0");
+
$.extend(this, {
active: false,
pixelState: 0,
@@ -97,11 +103,13 @@ $.widget("ui.progressbar", {
disable: function() {
this.element.addClass("ui-progressbar-disabled");
this.disabled = true;
+ this.element.ariaState("disabled", true);
},
enable: function() {
this.element.removeClass("ui-progressbar-disabled");
this.disabled = false;
+ this.element.ariaState("disabled", false);
},
pause: function() {
@@ -120,9 +128,11 @@ $.widget("ui.progressbar", {
this.bar.width(this.pixelState);
this.textElement.width(this.pixelState);
+ var percent = Math.round(this.percentState);
if (this.options.range && !this.options.text) {
- this.textElement.html(Math.round(this.percentState) + '%');
+ this.textElement.html(percent + '%');
}
+ this.element.ariaState("valuenow", percent);
this._propagate('progress', this.ui());
},