Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: options.js

Issue 29339231: Issue 3882 - Make checkbox labels sensitive on the option page (Closed)
Patch Set: Use <label> more consistently Created April 1, 2016, 1:33 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « options.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: options.js
===================================================================
--- a/options.js
+++ b/options.js
@@ -87,14 +87,22 @@
listItem.setAttribute("data-access", item.url || item.text);
var labelId = "label-" + (++maxLabelId);
- listItem.querySelector(".display").setAttribute("id", labelId);
+ var label = listItem.querySelector(".display");
+ label.setAttribute("id", labelId);
+
var control = listItem.querySelector(".control");
if (control)
{
- // We use aria-labelledby to avoid triggering the control when
- // interacting with the label
control.setAttribute("aria-labelledby", labelId);
control.addEventListener("click", this.details[j].onClick, false);
+
+ var role = control.getAttribute("role");
+ if (role == "checkbox" && !label.hasAttribute("data-action"))
+ {
+ var controlId = "control-" + maxLabelId;
+ control.setAttribute("id", controlId);
+ label.setAttribute("for", controlId);
+ }
}
this._setEmpty(table, null);
« no previous file with comments | « options.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld