From a68bc9319a784db42ba0a74411f8d700a4c57ed7 Mon Sep 17 00:00:00 2001 From: Hai Nguyen Van Date: Wed, 28 Jan 2026 03:33:56 +0000 Subject: [PATCH] MDL-87675 core: Add delay for displaying the YUI alert dialogue message * Add a slight delay for displaying the message content of the YUI alert dialogue's ARIA live container to allow screen readers to announce the alert message accordingly. --- .../moodle-core-notification-alert-debug.js | 4 +++- .../moodle-core-notification-alert-min.js | 2 +- .../moodle-core-notification-alert.js | 4 +++- lib/yui/src/notification/js/alert.js | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-debug.js b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-debug.js index a8c0ab489dd..46e50f3045b 100644 --- a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-debug.js +++ b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-debug.js @@ -69,7 +69,9 @@ Y.extend(ALERT, M.core.notification.info, { .append(Y.Node.create('
') .append(yes)); this.get(BASE).addClass('moodle-dialogue-confirm'); - this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE); + setTimeout((function() { + this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE); + }).bind(this), 100); this.setStdModContent(Y.WidgetStdMod.HEADER, '
' + this.get(TITLE) + '
', Y.WidgetStdMod.REPLACE); diff --git a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-min.js b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-min.js index f9e5770777d..ca9b58dbbec 100644 --- a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-min.js +++ b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-min.js @@ -1 +1 @@ -YUI.add("moodle-core-notification-alert",function(i,t){var e;M.core=M.core||{},i.extend(e=function(t){t.closeButton=!1,e.superclass.constructor.apply(this,[t])},M.core.notification.info,{_closeEvents:null,initializer:function(){var t,e;this._closeEvents=[],this.publish("complete"),t=i.Node.create(''),e=i.Node.create('
').append(i.Node.create('
'+this.get("message")+"
")).append(i.Node.create('
').append(t)),this.get("notificationBase").addClass("moodle-dialogue-confirm"),this.setStdModContent(i.WidgetStdMod.BODY,e,i.WidgetStdMod.REPLACE),this.setStdModContent(i.WidgetStdMod.HEADER,'
'+this.get("title")+"
",i.WidgetStdMod.REPLACE),this._closeEvents.push(i.on("key",this.submit,window,"down:13",this),t.on("click",this.submit,this)),(e=this.get("boundingBox").one(".closebutton"))&&this._closeEvents.push(e.on("click",this.submit,this))},submit:function(){new i.EventHandle(this._closeEvents).detach(),this.fire("complete"),this.hide(),this.destroy()}},{NAME:"Moodle alert",CSS_PREFIX:"moodle-dialogue",ATTRS:{title:{validator:i.Lang.isString,value:"Alert"},message:{validator:i.Lang.isString,value:"Confirm"},yesLabel:{validator:i.Lang.isString,setter:function(t){return t=t||"OK"},value:"OK"}}}),M.core.alert=e},"@VERSION@",{requires:["moodle-core-notification-dialogue"]}); \ No newline at end of file +YUI.add("moodle-core-notification-alert",function(i,t){var e;M.core=M.core||{},i.extend(e=function(t){t.closeButton=!1,e.superclass.constructor.apply(this,[t])},M.core.notification.info,{_closeEvents:null,initializer:function(){var t,e;this._closeEvents=[],this.publish("complete"),e=i.Node.create(''),t=i.Node.create('
').append(i.Node.create('
'+this.get("message")+"
")).append(i.Node.create('
').append(e)),this.get("notificationBase").addClass("moodle-dialogue-confirm"),setTimeout(function(){this.setStdModContent(i.WidgetStdMod.BODY,t,i.WidgetStdMod.REPLACE)}.bind(this),100),this.setStdModContent(i.WidgetStdMod.HEADER,'
'+this.get("title")+"
",i.WidgetStdMod.REPLACE),this._closeEvents.push(i.on("key",this.submit,window,"down:13",this),e.on("click",this.submit,this)),(e=this.get("boundingBox").one(".closebutton"))&&this._closeEvents.push(e.on("click",this.submit,this))},submit:function(){new i.EventHandle(this._closeEvents).detach(),this.fire("complete"),this.hide(),this.destroy()}},{NAME:"Moodle alert",CSS_PREFIX:"moodle-dialogue",ATTRS:{title:{validator:i.Lang.isString,value:"Alert"},message:{validator:i.Lang.isString,value:"Confirm"},yesLabel:{validator:i.Lang.isString,setter:function(t){return t=t||"OK"},value:"OK"}}}),M.core.alert=e},"@VERSION@",{requires:["moodle-core-notification-dialogue"]}); \ No newline at end of file diff --git a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert.js b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert.js index a8c0ab489dd..46e50f3045b 100644 --- a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert.js +++ b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert.js @@ -69,7 +69,9 @@ Y.extend(ALERT, M.core.notification.info, { .append(Y.Node.create('
') .append(yes)); this.get(BASE).addClass('moodle-dialogue-confirm'); - this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE); + setTimeout((function() { + this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE); + }).bind(this), 100); this.setStdModContent(Y.WidgetStdMod.HEADER, '
' + this.get(TITLE) + '
', Y.WidgetStdMod.REPLACE); diff --git a/lib/yui/src/notification/js/alert.js b/lib/yui/src/notification/js/alert.js index 432b0f5323e..d4a7f80949f 100644 --- a/lib/yui/src/notification/js/alert.js +++ b/lib/yui/src/notification/js/alert.js @@ -39,7 +39,9 @@ Y.extend(ALERT, M.core.notification.info, { .append(Y.Node.create('
') .append(yes)); this.get(BASE).addClass('moodle-dialogue-confirm'); - this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE); + setTimeout((function() { + this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE); + }).bind(this), 100); this.setStdModContent(Y.WidgetStdMod.HEADER, '
' + this.get(TITLE) + '
', Y.WidgetStdMod.REPLACE);