Skip to content

Commit 0838101

Browse files
authored
XWIKI-23101: XWiki Notifications alert too often (#4102)
* Removed the harmful role from the notifications themselves. The role is already on the container and handles notifying non visual users. * Added comments to avoid repeating the mistake I did in XWIKI-22709
1 parent e34208b commit 0838101

File tree

1 file changed

+3
-3
lines changed
  • xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/widgets

1 file changed

+3
-3
lines changed

xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/widgets/notification.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@ widgets.Notification = Class.create({
107107
/** Creates the HTML structure for the notification. */
108108
createElement : function() {
109109
if (!this.element) {
110-
// The ARIA role `alert` should give implicit values for `aria-live` and `aria-atomic`.
111-
this.element = new Element("div", {"class" : "xnotification xnotification-" + this.type,
112-
"role": "alert"}).update(this.text);
110+
// The notification container is already an ARIA "alert", those notifications do not need extra semantics.
111+
this.element = new Element("div", {"class" : "xnotification xnotification-" + this.type}).update(this.text);
113112
if (this.options.icon) {
114113
this.element.setStyle({backgroundImage : this.options.icon, paddingLeft : "22px"});
115114
}
@@ -167,6 +166,7 @@ widgets.Notification.getContainer = function() {
167166
if (!widgets.Notification.container) {
168167
widgets.Notification.container = new Element('div', {"class" : "xnotification-container"});
169168
// Make notifications alert / accessible for screen readers
169+
// The ARIA role `alert` should give implicit values for `aria-live` and `aria-atomic`.
170170
widgets.Notification.container.writeAttribute("role", "alert");
171171
// Insert the container in the document body.
172172
$('body').insert(widgets.Notification.container);

0 commit comments

Comments
 (0)