MDL-30899 moodle-core-notification Adding ARIA attributes
authorDavid Monllao <davidm@moodle.com>
Fri, 21 Sep 2012 01:29:15 +0000 (09:29 +0800)
committerDavid Monllao <davidm@moodle.com>
Tue, 27 Nov 2012 06:41:42 +0000 (14:41 +0800)
lib/yui/notification/notification.js

index 9bd1543..eca0664 100644 (file)
@@ -29,7 +29,7 @@ var DIALOGUE = function(config) {
     var id = 'moodle-dialogue-'+COUNT;
     config.notificationBase =
         C('<div class="'+CSS.BASE+'">')
-            .append(C('<div id="'+id+'" class="'+CSS.WRAP+'"></div>')
+            .append(C('<div id="'+id+'" role="dialog" aria-labelledby="'+id+'-header-text" class="'+CSS.WRAP+'"></div>')
                 .append(C('<div class="'+CSS.HEADER+' yui3-widget-hd"></div>'))
                 .append(C('<div class="'+CSS.BODY+' yui3-widget-bd"></div>'))
                 .append(C('<div class="'+CSS.FOOTER+' yui3-widget-ft"></div>')));
@@ -146,7 +146,7 @@ Y.extend(ALERT, DIALOGUE, {
                             .append(yes));
         this.get(BASE).addClass('moodle-dialogue-confirm');
         this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
-        this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1>' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
+        this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1 id="moodle-dialogue-'+COUNT+'-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
         this.after('destroyedChange', function(){this.get(BASE).remove();}, this);
         this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this);
         yes.on('click', this.submit, this);
@@ -201,7 +201,7 @@ Y.extend(CONFIRM, DIALOGUE, {
                             .append(no));
         this.get(BASE).addClass('moodle-dialogue-confirm');
         this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
-        this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1>' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
+        this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1 id="moodle-dialogue-'+COUNT+'-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
         this.after('destroyedChange', function(){this.get(BASE).remove();}, this);
         this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this, true);
         this._escKeypress = Y.on('key', this.submit, window, 'down:27', this, false);
@@ -254,7 +254,7 @@ Y.extend(EXCEPTION, DIALOGUE, {
     _keypress : null,
     initializer : function(config) {
         this.get(BASE).addClass('moodle-dialogue-exception');
-        this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1>' + config.name + '</h1>', Y.WidgetStdMod.REPLACE);
+        this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1 id="moodle-dialogue-'+COUNT+'-header-text">' + config.name + '</h1>', Y.WidgetStdMod.REPLACE);
         var content = C('<div class="moodle-exception"></div>')
                     .append(C('<div class="moodle-exception-message">'+this.get('message')+'</div>'))
                     .append(C('<div class="moodle-exception-param hidden param-filename"><label>File:</label> '+this.get('fileName')+'</div>'))
@@ -325,7 +325,7 @@ Y.extend(AJAXEXCEPTION, DIALOGUE, {
     _keypress : null,
     initializer : function(config) {
         this.get(BASE).addClass('moodle-dialogue-exception');
-        this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1>' + config.name + '</h1>', Y.WidgetStdMod.REPLACE);
+        this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1 id="moodle-dialogue-'+COUNT+'-header-text">' + config.name + '</h1>', Y.WidgetStdMod.REPLACE);
         var content = C('<div class="moodle-ajaxexception"></div>')
                     .append(C('<div class="moodle-exception-message">'+this.get('error')+'</div>'))
                     .append(C('<div class="moodle-exception-param hidden param-debuginfo"><label>URL:</label> '+this.get('reproductionlink')+'</div>'))