' +
'{{#split "\n" elements}}' +
@@ -220,14 +223,12 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
focusAfterHide: true,
width: 600,
- focusOnShowSelector: SELECTORS.EQUATION_TEXT
+ focusOnShowSelector: SELECTORS.LIBRARY_BUTTON
});
var content = this._getDialogueContent();
dialogue.set('bodyContent', content);
- content.one('.nav-item:first-child .nav-link').getDOMNode().click();
-
dialogue.show();
// Notify the filters about the modified nodes.
require(['core/event'], function(event) {
diff --git a/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-button/moodle-atto_managefiles-button-debug.js b/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-button/moodle-atto_managefiles-button-debug.js
index 59199a492cd..ff55e3d878e 100644
--- a/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-button/moodle-atto_managefiles-button-debug.js
+++ b/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-button/moodle-atto_managefiles-button-debug.js
@@ -33,7 +33,9 @@ YUI.add('moodle-atto_managefiles-button', function (Y, NAME) {
* @extends M.editor_atto.EditorPlugin
*/
-var LOGNAME = 'atto_managefiles';
+var LOGNAME = 'atto_managefiles',
+ CAN_RECEIVE_FOCUS_SELECTOR = '.fp-navbar a:not([disabled])',
+ FILE_MANAGER_SELECTOR = '#fitem_id_files_filemanager';
Y.namespace('M.atto_managefiles').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
@@ -96,6 +98,22 @@ Y.namespace('M.atto_managefiles').Button = Y.Base.create('button', Y.M.editor_at
});
iframe.setAttribute('src', this._getIframeURL());
+ // Focus on the first focusable element of the file manager after it is fully loaded.
+ iframe.on('load', function(e, frame) {
+ var fileManager = frame.getDOMNode().contentDocument.querySelector(FILE_MANAGER_SELECTOR);
+ // The file manager component is loaded asynchronously after the page is loaded.
+ // We check for the presence of .fm-loaded every 200 ms to determine if the file manager is loaded yet.
+ var intervalId = setInterval(function() {
+ if (fileManager.querySelector('.fm-loaded')) {
+ var firstFocusableElement = fileManager.querySelector(CAN_RECEIVE_FOCUS_SELECTOR);
+ if (firstFocusableElement) {
+ firstFocusableElement.focus();
+ }
+ clearInterval(intervalId);
+ }
+ }, 200);
+ }, this, iframe);
+
dialogue.set('bodyContent', iframe)
.show();
diff --git a/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-button/moodle-atto_managefiles-button-min.js b/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-button/moodle-atto_managefiles-button-min.js
index 16ab8ed38b2..60c6c8ffe29 100644
--- a/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-button/moodle-atto_managefiles-button-min.js
+++ b/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-button/moodle-atto_managefiles-button-min.js
@@ -1 +1 @@
-YUI.add("moodle-atto_managefiles-button",function(a,e){a.namespace("M.atto_managefiles").Button=a.Base.create("button",a.M.editor_atto.EditorPlugin,[],{_currentSelection:null,initializer:function(){if(!this.get("disabled")){var e=this.get("host"),t=this.get("area"),i=e.get("filepickeroptions");i.image&&i.image.itemid&&(t.itemid=i.image.itemid,this.set("area",t),this.addButton({icon:"e/manage_files",callback:this._displayDialogue}))}},_displayDialogue:function(e){var t,i;e.preventDefault(),t=this.getDialogue({headerContent:M.util.get_string("managefiles","atto_managefiles"),width:"800px",focusAfterHide:!0}),(i=a.Node.create("")).setStyles({height:"700px",border:"none",width:"100%"}),i.setAttribute("src",this._getIframeURL()),t.set("bodyContent",i).show(),this.markUpdated()},_getIframeURL:function(){var e=a.mix({elementid:this.get("host").get("elementid")},this.get("area"));return M.cfg.wwwroot+"/lib/editor/atto/plugins/managefiles/manage.php?"+a.QueryString.stringify(e)}},{ATTRS:{disabled:{value:!0},area:{value:{}}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
\ No newline at end of file
+YUI.add("moodle-atto_managefiles-button",function(a,e){a.namespace("M.atto_managefiles").Button=a.Base.create("button",a.M.editor_atto.EditorPlugin,[],{_currentSelection:null,initializer:function(){if(!this.get("disabled")){var e=this.get("host"),t=this.get("area"),i=e.get("filepickeroptions");i.image&&i.image.itemid&&(t.itemid=i.image.itemid,this.set("area",t),this.addButton({icon:"e/manage_files",callback:this._displayDialogue}))}},_displayDialogue:function(e){var t,i;e.preventDefault(),t=this.getDialogue({headerContent:M.util.get_string("managefiles","atto_managefiles"),width:"800px",focusAfterHide:!0}),(i=a.Node.create("")).setStyles({height:"700px",border:"none",width:"100%"}),i.setAttribute("src",this._getIframeURL()),i.on("load",function(e,t){var i=t.getDOMNode().contentDocument.querySelector("#fitem_id_files_filemanager"),a=setInterval(function(){if(i.querySelector(".fm-loaded")){var e=i.querySelector(".fp-navbar a:not([disabled])");e&&e.focus(),clearInterval(a)}},200)},this,i),t.set("bodyContent",i).show(),this.markUpdated()},_getIframeURL:function(){var e=a.mix({elementid:this.get("host").get("elementid")},this.get("area"));return M.cfg.wwwroot+"/lib/editor/atto/plugins/managefiles/manage.php?"+a.QueryString.stringify(e)}},{ATTRS:{disabled:{value:!0},area:{value:{}}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
\ No newline at end of file
diff --git a/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-button/moodle-atto_managefiles-button.js b/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-button/moodle-atto_managefiles-button.js
index 1434a96e9df..7dbc265997e 100644
--- a/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-button/moodle-atto_managefiles-button.js
+++ b/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-button/moodle-atto_managefiles-button.js
@@ -33,7 +33,9 @@ YUI.add('moodle-atto_managefiles-button', function (Y, NAME) {
* @extends M.editor_atto.EditorPlugin
*/
-var LOGNAME = 'atto_managefiles';
+var LOGNAME = 'atto_managefiles',
+ CAN_RECEIVE_FOCUS_SELECTOR = '.fp-navbar a:not([disabled])',
+ FILE_MANAGER_SELECTOR = '#fitem_id_files_filemanager';
Y.namespace('M.atto_managefiles').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
@@ -94,6 +96,22 @@ Y.namespace('M.atto_managefiles').Button = Y.Base.create('button', Y.M.editor_at
});
iframe.setAttribute('src', this._getIframeURL());
+ // Focus on the first focusable element of the file manager after it is fully loaded.
+ iframe.on('load', function(e, frame) {
+ var fileManager = frame.getDOMNode().contentDocument.querySelector(FILE_MANAGER_SELECTOR);
+ // The file manager component is loaded asynchronously after the page is loaded.
+ // We check for the presence of .fm-loaded every 200 ms to determine if the file manager is loaded yet.
+ var intervalId = setInterval(function() {
+ if (fileManager.querySelector('.fm-loaded')) {
+ var firstFocusableElement = fileManager.querySelector(CAN_RECEIVE_FOCUS_SELECTOR);
+ if (firstFocusableElement) {
+ firstFocusableElement.focus();
+ }
+ clearInterval(intervalId);
+ }
+ }, 200);
+ }, this, iframe);
+
dialogue.set('bodyContent', iframe)
.show();
diff --git a/lib/editor/atto/plugins/managefiles/yui/src/button/js/button.js b/lib/editor/atto/plugins/managefiles/yui/src/button/js/button.js
index 3ba25e56f79..abf0012e3bf 100644
--- a/lib/editor/atto/plugins/managefiles/yui/src/button/js/button.js
+++ b/lib/editor/atto/plugins/managefiles/yui/src/button/js/button.js
@@ -31,7 +31,9 @@
* @extends M.editor_atto.EditorPlugin
*/
-var LOGNAME = 'atto_managefiles';
+var LOGNAME = 'atto_managefiles',
+ CAN_RECEIVE_FOCUS_SELECTOR = '.fp-navbar a:not([disabled])',
+ FILE_MANAGER_SELECTOR = '#fitem_id_files_filemanager';
Y.namespace('M.atto_managefiles').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
@@ -94,6 +96,22 @@ Y.namespace('M.atto_managefiles').Button = Y.Base.create('button', Y.M.editor_at
});
iframe.setAttribute('src', this._getIframeURL());
+ // Focus on the first focusable element of the file manager after it is fully loaded.
+ iframe.on('load', function(e, frame) {
+ var fileManager = frame.getDOMNode().contentDocument.querySelector(FILE_MANAGER_SELECTOR);
+ // The file manager component is loaded asynchronously after the page is loaded.
+ // We check for the presence of .fm-loaded every 200 ms to determine if the file manager is loaded yet.
+ var intervalId = setInterval(function() {
+ if (fileManager.querySelector('.fm-loaded')) {
+ var firstFocusableElement = fileManager.querySelector(CAN_RECEIVE_FOCUS_SELECTOR);
+ if (firstFocusableElement) {
+ firstFocusableElement.focus();
+ }
+ clearInterval(intervalId);
+ }
+ }, 200);
+ }, this, iframe);
+
dialogue.set('bodyContent', iframe)
.show();
diff --git a/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-debug.js b/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-debug.js
index e6fd0f403b2..b13c08e142d 100644
--- a/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-debug.js
+++ b/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-debug.js
@@ -184,7 +184,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
* @private
*/
_audio: function() {
- var dialogue = this.getDialogue();
+ var dialogue = this.getDialogue({
+ focusAfterHide: 'audio'
+ });
dialogue.set('headerContent', M.util.get_string('audiortc', 'atto_recordrtc'));
dialogue.set('bodyContent', this._createContent('audio'));
@@ -201,7 +203,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
* @private
*/
_video: function() {
- var dialogue = this.getDialogue();
+ var dialogue = this.getDialogue({
+ focusAfterHide: 'video'
+ });
dialogue.set('headerContent', M.util.get_string('videortc', 'atto_recordrtc'));
dialogue.set('bodyContent', this._createContent('video'));
@@ -249,7 +253,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
* @param {Object} scope The "this" context of the editor.
*/
closeDialogue: function(scope) {
- scope.getDialogue().hide();
+ scope.getDialogue().hide({
+ focusAfterHide: null
+ });
scope.editor.focus();
},
@@ -262,7 +268,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
* @param {string} annotation The HTML link to the recording.
*/
setLink: function(scope, annotation) {
- scope.getDialogue().hide();
+ scope.getDialogue().hide({
+ focusAfterHide: null
+ });
scope.editor.focus();
scope.get('host').insertContentAtFocusPoint(annotation);
diff --git a/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-min.js b/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-min.js
index 013087c2f2b..b4f3de302f6 100644
--- a/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-min.js
+++ b/lib/editor/atto/plugins/recordrtc/yui/build/moodle-atto_recordrtc-button/moodle-atto_recordrtc-button-min.js
@@ -1 +1 @@
-YUI.add("moodle-atto_recordrtc-button",function(s,t){var n="atto_recordrtc";s.namespace("M.atto_recordrtc").Button=s.Base.create("button",s.M.editor_atto.EditorPlugin,[],{_lang:"en",initializer:function(){var t,e,i;if(this.get("host").canShowFilepicker("media")){if(e=!1,"both"!==(t=this.get("allowedtypes"))&&"audio"!==t||(this._addButton("audio",this._audio),e=!0),"both"!==t&&"video"!==t||(this._addButton("video",this._video),e=!0),!e)return;(i=this.getDialogue({width:1e3,focusAfterHide:null})).after("visibleChange",function(){var t=!i.get("visible"),e=M.atto_recordrtc.commonmodule;t&&(window.clearInterval(e.countdownTicker),e.mediaRecorder&&"inactive"!==e.mediaRecorder.state&&e.mediaRecorder.stop(),e.stream&&e.stream.getTracks().forEach(function(t){"ended"!==t.readyState&&t.stop()}),this.getDialogue().set("bodyContent",""))},this),i.on("click",function(){this.centered()}),window.require(["core/adapter"],function(t){window.adapter=t})}},_addButton:function(t,e){this.addButton({buttonName:t,icon:this.get(t+"rtcicon"),iconComponent:n,callback:e,title:t+"rtc",tags:t+"rtc",tagMatchRequiresAll:!1})},_audio:function(){var t=this.getDialogue();t.set("headerContent",M.util.get_string("audiortc","atto_recordrtc")),t.set("bodyContent",this._createContent("audio")),t.show(),M.atto_recordrtc.audiomodule.init(this)},_video:function(){var t=this.getDialogue();t.set("headerContent",M.util.get_string("videortc","atto_recordrtc")),t.set("bodyContent",this._createContent("video")),t.show(),M.atto_recordrtc.videomodule.init(this)},_createContent:function(t){var e="audio"===t,i="row",o="col-",r="alert-danger",a="btn btn-lg btn-outline-danger btn-block",d=s.Handlebars.compile('
{{insecurealert_title}} {{insecurealert}}
{{#if isAudio}}{{else}}{{/if}}
')({PLUGINNAME:n,isAudio:e,bs_row:i,bs_col:o,bs_al_dang:r,bs_ss_btn:a,insecurealert_title:M.util.get_string("insecurealert_title","atto_recordrtc"),insecurealert:M.util.get_string("insecurealert","atto_recordrtc"),startrecording:M.util.get_string("startrecording","atto_recordrtc"),attachrecording:M.util.get_string("attachrecording","atto_recordrtc")});return d},closeDialogue:function(t){t.getDialogue().hide(),t.editor.focus()},setLink:function(t,e){t.getDialogue().hide(),t.editor.focus(),t.get("host").insertContentAtFocusPoint(e),t.markUpdated()}},{ATTRS:{contextid:{value:null},sesskey:{value:null},allowedtypes:{value:null},audiobitrate:{value:null},videobitrate:{value:null},timelimit:{value:null},audiortcicon:{value:null},videortcicon:{value:null},maxrecsize:{value:null}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","moodle-atto_recordrtc-recording"]});
\ No newline at end of file
+YUI.add("moodle-atto_recordrtc-button",function(s,t){var n="atto_recordrtc";s.namespace("M.atto_recordrtc").Button=s.Base.create("button",s.M.editor_atto.EditorPlugin,[],{_lang:"en",initializer:function(){var t,e,i;if(this.get("host").canShowFilepicker("media")){if(e=!1,"both"!==(t=this.get("allowedtypes"))&&"audio"!==t||(this._addButton("audio",this._audio),e=!0),"both"!==t&&"video"!==t||(this._addButton("video",this._video),e=!0),!e)return;(i=this.getDialogue({width:1e3,focusAfterHide:null})).after("visibleChange",function(){var t=!i.get("visible"),e=M.atto_recordrtc.commonmodule;t&&(window.clearInterval(e.countdownTicker),e.mediaRecorder&&"inactive"!==e.mediaRecorder.state&&e.mediaRecorder.stop(),e.stream&&e.stream.getTracks().forEach(function(t){"ended"!==t.readyState&&t.stop()}),this.getDialogue().set("bodyContent",""))},this),i.on("click",function(){this.centered()}),window.require(["core/adapter"],function(t){window.adapter=t})}},_addButton:function(t,e){this.addButton({buttonName:t,icon:this.get(t+"rtcicon"),iconComponent:n,callback:e,title:t+"rtc",tags:t+"rtc",tagMatchRequiresAll:!1})},_audio:function(){var t=this.getDialogue({focusAfterHide:"audio"});t.set("headerContent",M.util.get_string("audiortc","atto_recordrtc")),t.set("bodyContent",this._createContent("audio")),t.show(),M.atto_recordrtc.audiomodule.init(this)},_video:function(){var t=this.getDialogue({focusAfterHide:"video"});t.set("headerContent",M.util.get_string("videortc","atto_recordrtc")),t.set("bodyContent",this._createContent("video")),t.show(),M.atto_recordrtc.videomodule.init(this)},_createContent:function(t){var e="audio"===t,i="row",o="col-",r="alert-danger",d="btn btn-lg btn-outline-danger btn-block",a=s.Handlebars.compile('
")),M.cfg.developerdebug&&t.all(".moodle-exception-param").removeClass("hidden"),this.setStdModContent(d.WidgetStdMod.BODY,t,d.WidgetStdMod.REPLACE),o&&(this._hideTimeout=setTimeout(function(){i.hide()},o)),this.after("visibleChange",this.visibilityChanged,this),this._keypress=d.on("key",this.hide,window,"down:13, 27",this),this.centerDialogue()},visibilityChanged:function(e){if("visible"===e.attrName&&e.prevVal&&!e.newVal){var t=this;this._keypress.detach(),setTimeout(function(){t.destroy()},1e3)}}},{NAME:t,CSS_PREFIX:"moodle-dialogue",ATTRS:{error:{validator:d.Lang.isString,value:M.util.get_string("unknownerror","moodle")},debuginfo:{value:null},stacktrace:{value:null},reproductionlink:{setter:function(e){return null!==e&&(e=''+e.replace(M.cfg.wwwroot,"")+""),e},value:null},hideTimeoutDelay:{validator:d.Lang.isNumber,value:null}}}),M.core.ajaxException=i},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
\ No newline at end of file
+YUI.add("moodle-core-notification-ajaxexception",function(d,e){var t,i;M.core=M.core||{},t="Moodle AJAX exception",i=function(e){e.name=e.name||M.util.get_string("error","moodle"),e.closeButton=!0,i.superclass.constructor.apply(this,[e])},d.extend(i,M.core.notification.info,{_keypress:null,initializer:function(e){var t,i=this,o=this.get("hideTimeoutDelay"),a=M.util.get_string("labelsep","langconfig");this.get("notificationBase").addClass("moodle-dialogue-exception"),this.setStdModContent(d.WidgetStdMod.HEADER,'
",o.WidgetStdMod.REPLACE),this._closeEvents.push(o.on("key",this.submit,window,"down:13",this),t.on("click",this.submit,this)),(i=this.get("boundingBox").one(".closebutton"))&&this._closeEvents.push(i.on("click",this.submit,this))},submit:function(){new o.EventHandle(this._closeEvents).detach(),this.fire("complete"),this.hide(),this.destroy()}},{NAME:e,CSS_PREFIX:"moodle-dialogue",ATTRS:{title:{validator:o.Lang.isString,value:"Alert"},message:{validator:o.Lang.isString,value:"Confirm"},yesLabel:{validator:o.Lang.isString,setter:function(t){return t=t||"OK"},value:"OK"}}}),M.core.alert=i},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
\ No newline at end of file
+YUI.add("moodle-core-notification-alert",function(o,t){var e,i;M.core=M.core||{},e="Moodle alert",i=function(t){t.closeButton=!1,i.superclass.constructor.apply(this,[t])},o.extend(i,M.core.notification.info,{_closeEvents:null,initializer:function(){var t,e,i;this._closeEvents=[],this.publish("complete"),t=o.Node.create(''),e=o.Node.create('').append(o.Node.create('
",i.WidgetStdMod.REPLACE),this._closeEvents.push(i.on("key",this.submit,window,"down:27",this,!1),this._yesButton.on("click",this.submit,this,!0),this._noButton.on("click",this.submit,this,!1)),(e=this.get("boundingBox").one(".closebutton"))&&this._closeEvents.push(e.on("click",this.submit,this))},submit:function(t,e){new i.EventHandle(this._closeEvents).detach(),this.fire("complete",e),e?this.fire("complete-yes"):this.fire("complete-no"),this.hide(),this.destroy()}},{NAME:e,CSS_PREFIX:"moodle-dialogue",ATTRS:{yesLabel:{validator:i.Lang.isString,valueFn:function(){return M.util.get_string("yes","moodle")},setter:function(t){return this._yesButton&&this._yesButton.set("value",t),t}},noLabel:{validator:i.Lang.isString,valueFn:function(){return M.util.get_string("no","moodle")},setter:function(t){return this._noButton&&this._noButton.set("value",t),t}},title:{validator:i.Lang.isString,value:M.util.get_string("confirm","moodle")},question:{validator:i.Lang.isString,valueFn:function(){return M.util.get_string("areyousure","moodle")},setter:function(t){return this._question&&this._question.set("value",t),t}}}}),i.augment(o,i.EventTarget),M.core.confirm=o},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
\ No newline at end of file
+YUI.add("moodle-core-notification-confirm",function(i,t){var e,o;M.core=M.core||{},e="Moodle confirmation dialogue",o=function(t){o.superclass.constructor.apply(this,[t])},i.extend(o,M.core.notification.info,{_closeEvents:null,_yesButton:null,_noButton:null,_question:null,initializer:function(){var t,e;this._closeEvents=[],this.publish("complete"),this.publish("complete-yes"),this.publish("complete-no"),this._yesButton=i.Node.create(''),this._noButton=i.Node.create(''),this._question=i.Node.create('
',
+ Y.WidgetStdMod.REPLACE);
+
// Initialise the element cache.
this._hiddenSiblings = [];
@@ -316,10 +325,6 @@ Y.extend(DIALOGUE, Y.Panel, {
Y.one(titlebar).setStyle('cursor', 'move');
}
}
- require(['core/local/aria/focuslock'], function(FocusLockManager) {
- // Trap focus to the current bounding box.
- FocusLockManager.trapFocus(this.get('boundingBox').getDOMNode());
- }.bind(this));
// Only do accessibility hiding for modals because the ARIA spec
// says that all ARIA dialogues should be modal.
@@ -410,9 +415,12 @@ Y.extend(DIALOGUE, Y.Panel, {
Math.floor(Y.one(document.body).get('winWidth')) < this.get('responsiveWidth');
},
+ _focus: function() {
+ this.focus();
+ },
+
show: function() {
var result = null,
- header = this.headerNode,
content = this.bodyNode,
focusSelector = this.get('focusOnShowSelector'),
focusNode = null;
@@ -429,16 +437,18 @@ Y.extend(DIALOGUE, Y.Panel, {
focusNode = this.get('boundingBox').one(focusSelector);
}
if (!focusNode) {
- // Fall back to the header or the content if no focus node was found yet.
- if (header && header !== '') {
- focusNode = header;
- } else if (content && content !== '') {
- focusNode = content;
+ // Fall back to the first focusable element in the body of the dialogue if no focus node was found yet.
+ if (content && content !== '') {
+ focusNode = content.one(CAN_RECEIVE_FOCUS_SELECTOR);
}
}
- if (focusNode) {
- focusNode.focus();
- }
+ require(['core/local/aria/focuslock'], function(FocusLockManager) {
+ // Trap focus to the current bounding box.
+ FocusLockManager.trapFocus(this.get('boundingBox').getDOMNode());
+ if (focusNode) {
+ focusNode.focus();
+ }
+ }.bind(this));
return result;
},
diff --git a/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-min.js b/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-min.js
index 56cfc98f8fa..98487c06028 100644
--- a/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-min.js
+++ b/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-min.js
@@ -1,2 +1,2 @@
-YUI.add("moodle-core-notification-dialogue",function(n,e){var t,a,i,s,l,d,r,u,h,o,c,g="moodle-dialogue",f="notificationBase",v={BASE:"moodle-dialogue-base",WRAP:"moodle-dialogue-wrap",HEADER:"moodle-dialogue-hd",BODY:"moodle-dialogue-bd",CONTENT:"moodle-dialogue-content",FOOTER:"moodle-dialogue-ft",HIDDEN:"hidden",LIGHTBOX:"moodle-dialogue-lightbox"};M.core=M.core||{},t="Moodle dialogue",i=g+"-fullscreen",s=g+"-hidden",l=" [role=dialog]",d="[role=menubar]",r=".",u="moodle-has-zindex",h='input:not([type="hidden"]), a[href], button, textarea, select, [tabindex]',o="form",a=function(e){var t="moodle-dialogue-"+n.stamp(this)+"-wrap";e.notificationBase=n.Node.create('
',
+ Y.WidgetStdMod.REPLACE);
+
// Initialise the element cache.
this._hiddenSiblings = [];
@@ -316,10 +325,6 @@ Y.extend(DIALOGUE, Y.Panel, {
Y.one(titlebar).setStyle('cursor', 'move');
}
}
- require(['core/local/aria/focuslock'], function(FocusLockManager) {
- // Trap focus to the current bounding box.
- FocusLockManager.trapFocus(this.get('boundingBox').getDOMNode());
- }.bind(this));
// Only do accessibility hiding for modals because the ARIA spec
// says that all ARIA dialogues should be modal.
@@ -410,9 +415,12 @@ Y.extend(DIALOGUE, Y.Panel, {
Math.floor(Y.one(document.body).get('winWidth')) < this.get('responsiveWidth');
},
+ _focus: function() {
+ this.focus();
+ },
+
show: function() {
var result = null,
- header = this.headerNode,
content = this.bodyNode,
focusSelector = this.get('focusOnShowSelector'),
focusNode = null;
@@ -429,16 +437,18 @@ Y.extend(DIALOGUE, Y.Panel, {
focusNode = this.get('boundingBox').one(focusSelector);
}
if (!focusNode) {
- // Fall back to the header or the content if no focus node was found yet.
- if (header && header !== '') {
- focusNode = header;
- } else if (content && content !== '') {
- focusNode = content;
+ // Fall back to the first focusable element in the body of the dialogue if no focus node was found yet.
+ if (content && content !== '') {
+ focusNode = content.one(CAN_RECEIVE_FOCUS_SELECTOR);
}
}
- if (focusNode) {
- focusNode.focus();
- }
+ require(['core/local/aria/focuslock'], function(FocusLockManager) {
+ // Trap focus to the current bounding box.
+ FocusLockManager.trapFocus(this.get('boundingBox').getDOMNode());
+ if (focusNode) {
+ focusNode.focus();
+ }
+ }.bind(this));
return result;
},
diff --git a/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-debug.js b/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-debug.js
index bcc3261ae19..22d883728ec 100644
--- a/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-debug.js
+++ b/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-debug.js
@@ -77,7 +77,7 @@ Y.extend(EXCEPTION, M.core.notification.info, {
labelsep = M.util.get_string('labelsep', 'langconfig');
this.get(BASE).addClass('moodle-dialogue-exception');
this.setStdModContent(Y.WidgetStdMod.HEADER,
- '
")),M.cfg.developerdebug&&i.all(".moodle-exception-param").removeClass("hidden"),this.setStdModContent(l.WidgetStdMod.BODY,i,l.WidgetStdMod.REPLACE),a&&(this._hideTimeout=setTimeout(function(){t.hide()},a)),this.after("visibleChange",this.visibilityChanged,this),this._keypress=l.on("key",this.hide,window,"down:13,27",this),this.centerDialogue()},visibilityChanged:function(e){if("visible"===e.attrName&&e.prevVal&&!e.newVal){this._keypress&&this._keypress.detach();var i=this;setTimeout(function(){i.destroy()},1e3)}}},{NAME:i,CSS_PREFIX:"moodle-dialogue",ATTRS:{message:{value:""},name:{value:""},fileName:{value:""},lineNumber:{value:""},stack:{setter:function(e){var i,t=l.Escape.html(e).split("\n"),a=new RegExp("^(.+)@("+M.cfg.wwwroot+")?(.{0,75}).*:(\\d+)$");for(i in t)t[i]=t[i].replace(a,"
ln: $4
$3
$1
");return t.join("\n")},value:""},hideTimeoutDelay:{validator:l.Lang.isNumber,value:null}}}),M.core.exception=a},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
\ No newline at end of file
+YUI.add("moodle-core-notification-exception",function(l,e){var i,a;M.core=M.core||{},i="Moodle exception",a=function(i){var e,t=l.mix({},i);t.width=t.width||M.cfg.developerdebug?Math.floor(l.one(document.body).get("winWidth")/3)+"px":null,t.closeButton=!0,e=["message","name","fileName","lineNumber","stack"],l.Array.each(e,function(e){t[e]=i[e]}),a.superclass.constructor.apply(this,[t])},l.extend(a,M.core.notification.info,{_hideTimeout:null,_keypress:null,initializer:function(e){var i,t=this,a=this.get("hideTimeoutDelay"),o=M.util.get_string("labelsep","langconfig");this.get("notificationBase").addClass("moodle-dialogue-exception"),this.setStdModContent(l.WidgetStdMod.HEADER,'
',
+ Y.WidgetStdMod.REPLACE);
+
// Initialise the element cache.
this._hiddenSiblings = [];
@@ -286,10 +295,6 @@ Y.extend(DIALOGUE, Y.Panel, {
Y.one(titlebar).setStyle('cursor', 'move');
}
}
- require(['core/local/aria/focuslock'], function(FocusLockManager) {
- // Trap focus to the current bounding box.
- FocusLockManager.trapFocus(this.get('boundingBox').getDOMNode());
- }.bind(this));
// Only do accessibility hiding for modals because the ARIA spec
// says that all ARIA dialogues should be modal.
@@ -380,9 +385,12 @@ Y.extend(DIALOGUE, Y.Panel, {
Math.floor(Y.one(document.body).get('winWidth')) < this.get('responsiveWidth');
},
+ _focus: function() {
+ this.focus();
+ },
+
show: function() {
var result = null,
- header = this.headerNode,
content = this.bodyNode,
focusSelector = this.get('focusOnShowSelector'),
focusNode = null;
@@ -399,16 +407,18 @@ Y.extend(DIALOGUE, Y.Panel, {
focusNode = this.get('boundingBox').one(focusSelector);
}
if (!focusNode) {
- // Fall back to the header or the content if no focus node was found yet.
- if (header && header !== '') {
- focusNode = header;
- } else if (content && content !== '') {
- focusNode = content;
+ // Fall back to the first focusable element in the body of the dialogue if no focus node was found yet.
+ if (content && content !== '') {
+ focusNode = content.one(CAN_RECEIVE_FOCUS_SELECTOR);
}
}
- if (focusNode) {
- focusNode.focus();
- }
+ require(['core/local/aria/focuslock'], function(FocusLockManager) {
+ // Trap focus to the current bounding box.
+ FocusLockManager.trapFocus(this.get('boundingBox').getDOMNode());
+ if (focusNode) {
+ focusNode.focus();
+ }
+ }.bind(this));
return result;
},
diff --git a/lib/yui/src/notification/js/exception.js b/lib/yui/src/notification/js/exception.js
index 6e00d1967c7..e346c38524e 100644
--- a/lib/yui/src/notification/js/exception.js
+++ b/lib/yui/src/notification/js/exception.js
@@ -47,7 +47,7 @@ Y.extend(EXCEPTION, M.core.notification.info, {
labelsep = M.util.get_string('labelsep', 'langconfig');
this.get(BASE).addClass('moodle-dialogue-exception');
this.setStdModContent(Y.WidgetStdMod.HEADER,
- '