Merge branch 'MDL-35925-master' of git://github.com/phalacee/moodle
authorDan Poltawski <dan@moodle.com>
Mon, 2 Sep 2013 07:23:05 +0000 (15:23 +0800)
committerDan Poltawski <dan@moodle.com>
Mon, 2 Sep 2013 07:23:05 +0000 (15:23 +0800)
Conflicts:
lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-min.js

1  2 
lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-debug.js
lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-min.js
lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue.js
lib/yui/src/notification/js/dialogue.js
repository/filepicker.js

@@@ -44,7 -44,7 +44,7 @@@ DIALOGUE = function(config) 
      config.srcNode =    '#'+id;
      config.width =      config.width || '400px';
      config.visible =    config.visible || false;
 -    config.center =     config.centered || true;
 +    config.center =     config.centered && true;
      config.centered =   false;
      config.COUNT = COUNT;
  
@@@ -303,6 -303,26 +303,26 @@@ Y.extend(DIALOGUE, Y.Panel, 
      shouldResizeFullscreen : function() {
          return (window === window.parent) && this.get('responsive') &&
                 Math.floor(Y.one(document.body).get('winWidth')) < this.get('responsiveWidth');
+     },
+     /**
+      * Override the show method to set keyboard focus on the dialogue.
+      *
+      * @method show
+      * @return void
+      */
+     show : function() {
+         var result = null,
+             header = this.headerNode,
+             content = this.bodyNode;
+         result = DIALOGUE.superclass.show.call(this);
+         if (header && header !== '') {
+             header.focus();
+         } else if (content && content !== '') {
+             content.focus();
+         }
+         return result;
      }
  }, {
      NAME : DIALOGUE_NAME,
diff --combined repository/filepicker.js
@@@ -791,14 -791,6 +791,14 @@@ M.core_filepicker.init = function(Y, op
              } else {
                  this.view_as_icons(appenditems);
              }
 +            this.fpnode.one('.fp-content').setAttribute('tabindex', '0');
 +            // Temporary fix for IE8 until MDL-41229 is integrated.
 +            // The role dialog is needed for screen reader to read
 +            // the filepicker's content (MDL-41232).
 +            this.fpnode.one('.fp-content').setAttribute('role', 'dialog');
 +            this.fpnode.one('.fp-content').setAttribute('aria-live', 'assertive');
 +            // End of temporary fix.
 +            this.fpnode.one('.fp-content').focus();
              // display/hide the link for requesting next page
              if (!appenditems && this.active_repo.hasmorepages) {
                  if (!this.fpnode.one('.fp-content .fp-nextpage')) {
          },
          render: function() {
              var client_id = this.options.client_id;
+             var fpid = "filepicker-"+ client_id;
+             var labelid = 'fp-dialog-label_'+ client_id;
              this.fpnode = Y.Node.createWithFilesSkin(M.core_filepicker.templates.generallayout).
-                 set('id', 'filepicker-'+client_id);
+                 set('id', 'filepicker-'+client_id).set('aria-labelledby', labelid);
              this.mainui = new M.core.dialogue({
                  extraClasses : ['filepicker'],
                  draggable    : true,
                  bodyContent  : this.fpnode,
-                 headerContent: M.str.repository.filepicker,
+                 headerContent: '<span id="'+ labelid +'">'+ M.str.repository.filepicker +'</span>',
                  centered     : true,
                  modal        : true,
                  visible      : false,