Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Unified Diff: ui/webui/resources/js/cr/ui/list_item.js

Issue 2346393004: Give descendants of cr.ui.ListItem a unique ID to fix accessibility. (Closed)
Patch Set: Fix two test failures Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/webui/resources/js/cr/ui/list.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/cr/ui/list_item.js
diff --git a/ui/webui/resources/js/cr/ui/list_item.js b/ui/webui/resources/js/cr/ui/list_item.js
index e548a8080186febe25af62b5dc25a7e0313748e7..cb6aacfc123504baf5c9ac2c6817326ba69ccdda 100644
--- a/ui/webui/resources/js/cr/ui/list_item.js
+++ b/ui/webui/resources/js/cr/ui/list_item.js
@@ -11,6 +11,13 @@ cr.define('cr.ui', function() {
*/
var ListItem = cr.ui.define('li');
+ /**
+ * The next id suffix to use when giving each item an unique id.
+ * @type {number}
+ * @private
+ */
+ ListItem.nextUniqueIdSuffix_ = 0;
+
ListItem.prototype = {
__proto__: HTMLLIElement.prototype,
@@ -36,6 +43,8 @@ cr.define('cr.ui', function() {
*/
decorate: function() {
this.setAttribute('role', 'listitem');
+ if (!this.id)
+ this.id = 'listitem-' + ListItem.nextUniqueIdSuffix_++;
},
/**
« no previous file with comments | « ui/webui/resources/js/cr/ui/list.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698