Skip to content

Commit

Permalink
MDL-71672 javascript: Fix the markup in the header of YUI dialogs
Browse files Browse the repository at this point in the history
Move the close button out of the element that is set as the
aria-labelledby for the dialog.
Also used h5 for the dialog titles so they are consistent with
AMD modals.
  • Loading branch information
rezaies committed Jul 19, 2021
1 parent 902ab1e commit d970bf0
Show file tree
Hide file tree
Showing 23 changed files with 50 additions and 29 deletions.
Expand Up @@ -61,8 +61,8 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, {
labelsep = M.util.get_string('labelsep', 'langconfig');
this.get(BASE).addClass('moodle-dialogue-exception');
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">'
+ Y.Escape.html(config.name) + '</h1>',
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">'
+ Y.Escape.html(config.name) + '</h5>',
Y.WidgetStdMod.REPLACE);
content = Y.Node.create('<div class="moodle-ajaxexception" data-rel="fatalerror"></div>')
.append(Y.Node.create('<div class="moodle-exception-message">' + Y.Escape.html(this.get('error')) + '</div>'))
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -61,8 +61,8 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, {
labelsep = M.util.get_string('labelsep', 'langconfig');
this.get(BASE).addClass('moodle-dialogue-exception');
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">'
+ Y.Escape.html(config.name) + '</h1>',
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">'
+ Y.Escape.html(config.name) + '</h5>',
Y.WidgetStdMod.REPLACE);
content = Y.Node.create('<div class="moodle-ajaxexception" data-rel="fatalerror"></div>')
.append(Y.Node.create('<div class="moodle-exception-message">' + Y.Escape.html(this.get('error')) + '</div>'))
Expand Down
Expand Up @@ -71,7 +71,7 @@ Y.extend(ALERT, M.core.notification.info, {
this.get(BASE).addClass('moodle-dialogue-confirm');
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">' + this.get(TITLE) + '</h1>',
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">' + this.get(TITLE) + '</h5>',
Y.WidgetStdMod.REPLACE);

this._closeEvents.push(
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -71,7 +71,7 @@ Y.extend(ALERT, M.core.notification.info, {
this.get(BASE).addClass('moodle-dialogue-confirm');
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">' + this.get(TITLE) + '</h1>',
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">' + this.get(TITLE) + '</h5>',
Y.WidgetStdMod.REPLACE);

this._closeEvents.push(
Expand Down
Expand Up @@ -104,7 +104,7 @@ Y.extend(CONFIRM, M.core.notification.info, {
this.get(BASE).addClass('moodle-dialogue-confirm');
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">' + this.get(TITLE) + '</h1>',
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">' + this.get(TITLE) + '</h5>',
Y.WidgetStdMod.REPLACE);

this._closeEvents.push(
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -104,7 +104,7 @@ Y.extend(CONFIRM, M.core.notification.info, {
this.get(BASE).addClass('moodle-dialogue-confirm');
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">' + this.get(TITLE) + '</h1>',
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">' + this.get(TITLE) + '</h5>',
Y.WidgetStdMod.REPLACE);

this._closeEvents.push(
Expand Down
Expand Up @@ -73,7 +73,7 @@ DIALOGUE = function(config) {
'<div id="' + id + '" role="dialog" ' +
'aria-labelledby="' + id + '-header-text" class="' + CSS_CLASSES.WRAP + '" aria-live="polite"></div>'
)
.append(Y.Node.create('<div id="' + id + '-header-text" class="' + CSS_CLASSES.HEADER + ' yui3-widget-hd"></div>'))
.append(Y.Node.create('<div class="' + CSS_CLASSES.HEADER + ' yui3-widget-hd"></div>'))
.append(Y.Node.create('<div class="' + CSS_CLASSES.BODY + ' yui3-widget-bd"></div>'))
.append(Y.Node.create('<div class="' + CSS_CLASSES.FOOTER + ' yui3-widget-ft"></div>')));
Y.one(document.body).append(config.notificationBase);
Expand Down Expand Up @@ -138,6 +138,10 @@ Y.extend(DIALOGUE, Y.Panel, {
this.get('buttons').header[0].setAttribute('aria-label', title);
}

this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h5 id="' + this.get('id') + '-wrap-header-text">' + this.get('headerContent') + '</h5>',
Y.WidgetStdMod.REPLACE);

// Initialise the element cache.
this._hiddenSiblings = [];

Expand Down

0 comments on commit d970bf0

Please sign in to comment.