Prtksxna has uploaded a new change for review.
https://gerrit.wikimedia.org/r/213195
Change subject: Label dialogs in aria terms
......................................................................
Label dialogs in aria terms
Give the title and $body unique IDs, and use those to add the
'aria-labelledby' and 'aria-describedby' attributes on the dialog.
Bug: T87826
Change-Id: Ia78adbb01f747783752b661fcc021146de22eecf
---
M src/Dialog.js
M src/core.js
2 files changed, 26 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/95/213195/1
diff --git a/src/Dialog.js b/src/Dialog.js
index 3322603..6636959 100644
--- a/src/Dialog.js
+++ b/src/Dialog.js
@@ -259,11 +259,21 @@
// Parent method
OO.ui.Dialog.super.prototype.initialize.call( this );
+ var titleId = OO.ui.generateElementId(),
+ bodyId = OO.ui.generateElementId();
+
// Properties
- this.title = new OO.ui.LabelWidget();
+ this.title = new OO.ui.LabelWidget( {
+ id: titleId
+ } );
// Initialization
this.$content.addClass( 'oo-ui-dialog-content' );
+ this.$body.attr( 'id', bodyId );
+ this.$element.attr( {
+ 'aria-labelledby': titleId,
+ 'aria-describedby': bodyId
+ } );
this.setPendingElement( this.$head );
};
diff --git a/src/core.js b/src/core.js
index 1331f5c..f77c3f2 100644
--- a/src/core.js
+++ b/src/core.js
@@ -31,6 +31,21 @@
};
/**
+ * @property {Number}
+ */
+OO.ui.elementId = 0;
+
+/**
+ * Generate a unique ID for element
+ *
+ * @return {String} [id]
+ */
+OO.ui.generateElementId = function () {
+ OO.ui.elementId += 1;
+ return 'ooui-' + OO.ui.elementId;
+}
+
+/**
* Check if an element is focusable.
* Inspired from :focusable in jQueryUI v1.11.4 - 2015-04-14
*
--
To view, visit https://gerrit.wikimedia.org/r/213195
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia78adbb01f747783752b661fcc021146de22eecf
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Prtksxna <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits