Commit a13dd17c authored by Frederic Massart's avatar Frederic Massart Committed by Dan Poltawski
Browse files

MDL-55593 core: Drag & drop accessible menu uses aria attributes

Part of MDL-55071
parent f572e724
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -358,9 +358,25 @@ Y.extend(DRAGDROP, Y.Base, {
* @return {string} The text of the first text-like child node of n.
*/
find_element_text: function(n) {
var text = '';
// Try to resolve using aria-label first.
text = n.get('aria-label') || '';
if (text.length > 0) {
return text;
}
// Now try to resolve using aria-labelledby.
var labelledByNode = n.get('aria-labelledby');
if (labelledByNode) {
var labelNode = Y.one('#' + labelledByNode);
if (labelNode && labelNode.get('text').length > 0) {
return labelNode.get('text');
}
}
// The valid node types to get text from.
var nodes = n.all('h2, h3, h4, h5, span:not(.actions):not(.menu-action-text), p, div.no-overflow, div.dimmed_text');
var text = '';
nodes.each(function() {
if (text === '') {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment