From 1b4acd4f3f6561f592f6285110edfc861e1129cd Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Tue, 7 Apr 2020 20:50:13 +1000 Subject: [PATCH 01/12] MDL-68353 core: Set aria-label for close buttons on YUI dialogues --- .../moodle-core-notification-dialogue-debug.js | 6 ++++-- .../moodle-core-notification-dialogue-min.js | 4 ++-- .../moodle-core-notification-dialogue.js | 6 ++++-- lib/yui/src/notification/js/dialogue.js | 6 ++++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-debug.js b/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-debug.js index b7844a04c48..65516231eea 100644 --- a/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-debug.js +++ b/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-debug.js @@ -127,8 +127,10 @@ Y.extend(DIALOGUE, Y.Panel, { var bb; if (this.get('closeButton') !== false) { - // The buttons constructor does not allow custom attributes - this.get('buttons').header[0].setAttribute('title', this.get('closeButtonTitle')); + var title = this.get('closeButtonTitle'); + // The buttons constructor does not allow custom attributes. + this.get('buttons').header[0].setAttribute('title', title); + this.get('buttons').header[0].setAttribute('aria-label', title); } // Initialise the element cache. 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 596a3487947..56cfc98f8fa 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('
').append(n.Node.create('').append(n.Node.create('
')).append(n.Node.create('
')).append(n.Node.create('
'))),n.one(document.body).append(e.notificationBase),e.srcNode="#"+t,delete e.buttons,a.superclass.constructor.apply(this,[e])},n.extend(a,n.Panel,{_resizeevent:null,_orientationevent:null,_calculatedzindex:!1,_currentMaskNodeId:null,_originalPosition:null,_hiddenSiblings:null,hideIfNotForm:function(){null===this.get("boundingBox").one(o)&&this.hide()},initializer:function(){var e,t,i;!1!==this.get("closeButton")&&this.get("buttons").header[0].setAttribute("title",this.get("closeButtonTitle")),this._hiddenSiblings=[],this.get("render")&&this.render(),this.after("visibleChange",this.visibilityChanged,this),this.get("center")&&this.centerDialogue(),this.get("modal")&&(this.get(f).set("aria-hidden","true"),this.plug(n.M.core.LockScroll)),this.set("focusOn",n.Array(this.get("focusOn")).filter(function(e){return"focusoutside"!==e.eventName})),(e=this.get("boundingBox")).addClass(u),n.Array.each(this.get("extraClasses"),e.addClass,e),this.get("visible")&&this.applyZIndex(),this.on("maskShow",this.applyZIndex),this.on("maskShow",function(){var e,t=n.one(n.config.win),i=this.get("boundingBox");this.get("center")||(this._originalPosition=i.getXY()),e=this.get("maskNode"),this._currentMaskNodeId!==e.get("_yuid")&&(this._currentMaskNodeId=e.get("_yuid"),e.on("click",this.hideIfNotForm,this)),"fixed"!==i.getStyle("position")&&i.setStyles({top:t.get("scrollTop"),left:t.get("scrollLeft")})},this),t=this.get("notificationBase"),""!==(i=this.get("additionalBaseClass"))&&t.addClass(i),this.after("destroyedChange",function(){this.get(f).remove(!0)},this)},applyZIndex:function(){var i=1040,e=1,t=this.get("boundingBox"),o=this.get("maskNode"),s=this.get("zIndex");0===s||this._calculatedzindex?(n.all(l+", "+d+", "+r+u).each(function(e){var t=this.findZIndex(e);i').append(n.Node.create('').append(n.Node.create('
')).append(n.Node.create('
')).append(n.Node.create('
'))),n.one(document.body).append(e.notificationBase),e.srcNode="#"+t,delete e.buttons,a.superclass.constructor.apply(this,[e])},n.extend(a,n.Panel,{_resizeevent:null,_orientationevent:null,_calculatedzindex:!1,_currentMaskNodeId:null,_originalPosition:null,_hiddenSiblings:null,hideIfNotForm:function(){null===this.get("boundingBox").one(o)&&this.hide()},initializer:function(){var e,t,i,o;!1!==this.get("closeButton")&&(t=this.get("closeButtonTitle"),this.get("buttons").header[0].setAttribute("title",t),this.get("buttons").header[0].setAttribute("aria-label",t)),this._hiddenSiblings=[],this.get("render")&&this.render(),this.after("visibleChange",this.visibilityChanged,this),this.get("center")&&this.centerDialogue(),this.get("modal")&&(this.get(f).set("aria-hidden","true"),this.plug(n.M.core.LockScroll)),this.set("focusOn",n.Array(this.get("focusOn")).filter(function(e){return"focusoutside"!==e.eventName})),(e=this.get("boundingBox")).addClass(u),n.Array.each(this.get("extraClasses"),e.addClass,e),this.get("visible")&&this.applyZIndex(),this.on("maskShow",this.applyZIndex),this.on("maskShow",function(){var e,t=n.one(n.config.win),i=this.get("boundingBox");this.get("center")||(this._originalPosition=i.getXY()),e=this.get("maskNode"),this._currentMaskNodeId!==e.get("_yuid")&&(this._currentMaskNodeId=e.get("_yuid"),e.on("click",this.hideIfNotForm,this)),"fixed"!==i.getStyle("position")&&i.setStyles({top:t.get("scrollTop"),left:t.get("scrollLeft")})},this),i=this.get("notificationBase"),""!==(o=this.get("additionalBaseClass"))&&i.addClass(o),this.after("destroyedChange",function(){this.get(f).remove(!0)},this)},applyZIndex:function(){var i=1040,e=1,t=this.get("boundingBox"),o=this.get("maskNode"),s=this.get("zIndex");0===s||this._calculatedzindex?(n.all(l+", "+d+", "+r+u).each(function(e){var t=this.findZIndex(e);i Date: Tue, 7 Apr 2020 23:16:42 +1000 Subject: [PATCH 02/12] MDL-68353 core: do not output empty labels --- lib/form/templates/element-template.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/form/templates/element-template.mustache b/lib/form/templates/element-template.mustache index bbf538dbe9a..d9528fabd0e 100644 --- a/lib/form/templates/element-template.mustache +++ b/lib/form/templates/element-template.mustache @@ -49,7 +49,7 @@ {{#advanced}}!{{/advanced}} {{{helpbutton}}} - {{$ label }} + {{# label}}{{$ label }} {{^element.staticlabel}}
{{$ element }} From c2e48a1d855c7ece938f3087edad62e1dea82297 Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Wed, 8 Apr 2020 00:04:12 +1000 Subject: [PATCH 03/12] MDL-68353 form: Removed the size attribute The size attribute does not work with the checkbox input type. --- lib/form/templates/element-checkbox-inline.mustache | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/form/templates/element-checkbox-inline.mustache b/lib/form/templates/element-checkbox-inline.mustache index 994ebc5a786..fb90de4750b 100644 --- a/lib/form/templates/element-checkbox-inline.mustache +++ b/lib/form/templates/element-checkbox-inline.mustache @@ -13,7 +13,6 @@ value="1" {{/element.value}} {{#element.checked}}checked{{/element.checked}} - size="{{element.size}}" {{#error}} autofocus aria-describedby="{{element.iderror}}" {{/error}} From 5dad4a95acab5bcb77b57049cabd75199fead749 Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Wed, 8 Apr 2020 00:10:43 +1000 Subject: [PATCH 04/12] MDL-68353 form: Only include the size attribute if there is a size set --- lib/form/templates/element-advcheckbox-inline.mustache | 1 - lib/form/templates/element-password-inline.mustache | 2 +- lib/form/templates/element-password.mustache | 2 +- lib/form/templates/element-text-inline.mustache | 2 +- lib/form/templates/element-text.mustache | 2 +- lib/form/templates/element-url.mustache | 2 +- 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/form/templates/element-advcheckbox-inline.mustache b/lib/form/templates/element-advcheckbox-inline.mustache index 0584acc05d6..a47a25cc7dc 100644 --- a/lib/form/templates/element-advcheckbox-inline.mustache +++ b/lib/form/templates/element-advcheckbox-inline.mustache @@ -13,7 +13,6 @@ value="{{element.selectedvalue}}" {{/element.selectedvalue}} {{#element.checked}}checked{{/element.checked}} - size="{{element.size}}" {{#error}} autofocus aria-describedby="{{element.iderror}}" {{/error}} diff --git a/lib/form/templates/element-password-inline.mustache b/lib/form/templates/element-password-inline.mustache index 59da069256e..f832dec7df9 100644 --- a/lib/form/templates/element-password-inline.mustache +++ b/lib/form/templates/element-password-inline.mustache @@ -41,7 +41,7 @@ name="{{element.name}}" id="{{element.id}}" value="{{element.value}}" - size="{{element.size}}" + {{#element.size}}size="{{element.size}}"{{/element.size}} {{#error}} autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}}> diff --git a/lib/form/templates/element-password.mustache b/lib/form/templates/element-password.mustache index d6e80f8c2ab..9a7758d1081 100644 --- a/lib/form/templates/element-password.mustache +++ b/lib/form/templates/element-password.mustache @@ -41,7 +41,7 @@ name="{{element.name}}" id="{{element.id}}" value="{{element.value}}" - size="{{element.size}}" + {{#element.size}}size="{{element.size}}"{{/element.size}} {{#error}} autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}}> diff --git a/lib/form/templates/element-text-inline.mustache b/lib/form/templates/element-text-inline.mustache index b6bb3e91481..81f7a5a6d5c 100644 --- a/lib/form/templates/element-text-inline.mustache +++ b/lib/form/templates/element-text-inline.mustache @@ -8,7 +8,7 @@ readonly {{#element.hardfrozen}}disabled{{/element.hardfrozen}} {{/element.frozen}} value="{{element.value}}" - size="{{element.size}}" + {{#element.size}}size="{{element.size}}"{{/element.size}} {{#error}} autofocus aria-describedby="{{element.iderror}}" {{/error}} diff --git a/lib/form/templates/element-text.mustache b/lib/form/templates/element-text.mustache index 087201a6085..7e972a336f3 100644 --- a/lib/form/templates/element-text.mustache +++ b/lib/form/templates/element-text.mustache @@ -8,7 +8,7 @@ {{/element.frozen}} id="{{element.id}}" value="{{element.value}}" - size="{{element.size}}" + {{#element.size}}size="{{element.size}}"{{/element.size}} {{#error}} autofocus aria-describedby="{{element.iderror}}" {{/error}} diff --git a/lib/form/templates/element-url.mustache b/lib/form/templates/element-url.mustache index 5529d4a24ba..e161c8f8c2f 100644 --- a/lib/form/templates/element-url.mustache +++ b/lib/form/templates/element-url.mustache @@ -8,7 +8,7 @@ name="{{element.name}}" id="{{element.id}}" value="{{element.value}}" - size="{{element.size}}" + {{#element.size}}size="{{element.size}}"{{/element.size}} {{#error}} autofocus aria-describedby="{{element.iderror}}" {{/error}} From f792b0ace4277b66102e5cdfc03de9094e3a9834 Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Wed, 8 Apr 2020 01:09:55 +1000 Subject: [PATCH 05/12] MDL-68353 form: filemanager label fix --- .../templates/element-filemanager.mustache | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/form/templates/element-filemanager.mustache b/lib/form/templates/element-filemanager.mustache index 6f02ca05f26..f2607ebb8a6 100644 --- a/lib/form/templates/element-filemanager.mustache +++ b/lib/form/templates/element-filemanager.mustache @@ -1,5 +1,26 @@ {{< core_form/element-template }} + {{$label}} + {{^element.hiddenlabel}} + + {{/element.hiddenlabel}} + {{/label}} {{$element}} - {{{element.html}}} +
+ {{label}} + {{{element.html}}} +
{{/element}} {{/ core_form/element-template }} +{{#js}} +(function() { + var label = document.getElementById('{{element.id}}_label'); + if (label) { + label.style.cursor = 'default'; + label.addEventListener('click', function() { + document.querySelectorAll('#{{element.id}}_fieldset div.fp-toolbar a')[0].focus(); + }); + } +})(); +{{/js}} From 08be893a364dc1b25240a3e75a38b76b2f7c2c97 Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Wed, 8 Apr 2020 15:57:39 +1000 Subject: [PATCH 06/12] MDL-68353 core: replace invalid labels with div --- lib/templates/filemanager_fileselect.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/templates/filemanager_fileselect.mustache b/lib/templates/filemanager_fileselect.mustache index 83d9306e5c3..cbff550701e 100644 --- a/lib/templates/filemanager_fileselect.mustache +++ b/lib/templates/filemanager_fileselect.mustache @@ -60,13 +60,13 @@
- +
{{#str}}original, repository{{/str}}
{{#pix}}i/loading_small{{/pix}} {{#str}}loading, repository{{/str}}
- +
{{#str}}referenceslist, repository{{/str}}

{{#pix}}i/loading_small{{/pix}} {{#str}}loading, repository{{/str}} From 65b73df1c9330265e9f5b3ebc1e777f583248eea Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Wed, 8 Apr 2020 16:20:37 +1000 Subject: [PATCH 07/12] MDL-68353 message: enclose privacy settings within a fieldset --- ...drawer_view_settings_body_content.mustache | 31 ++++++++++--------- message/templates/message_index.mustache | 2 +- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/message/templates/message_drawer_view_settings_body_content.mustache b/message/templates/message_drawer_view_settings_body_content.mustache index f359f349411..4acd27d4bba 100644 --- a/message/templates/message_drawer_view_settings_body_content.mustache +++ b/message/templates/message_drawer_view_settings_body_content.mustache @@ -39,20 +39,23 @@

{{#str}} privacy, message {{/str}}

{{#str}} privacy_desc, message {{/str}}

- {{#privacy}} -
- - -
- {{/privacy}} +
+ {{#str}} contactableprivacy, message {{/str}} + {{#privacy}} +
+ + +
+ {{/privacy}} +