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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « options.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 var table = E(this.details[j].id); 80 var table = E(this.details[j].id);
81 var template = table.querySelector("template"); 81 var template = table.querySelector("template");
82 for (var i = 0; i < arguments.length; i++) 82 for (var i = 0; i < arguments.length; i++)
83 { 83 {
84 var item = arguments[i]; 84 var item = arguments[i];
85 var listItem = document.createElement("li"); 85 var listItem = document.createElement("li");
86 listItem.appendChild(document.importNode(template.content, true)); 86 listItem.appendChild(document.importNode(template.content, true));
87 listItem.setAttribute("data-access", item.url || item.text); 87 listItem.setAttribute("data-access", item.url || item.text);
88 88
89 var labelId = "label-" + (++maxLabelId); 89 var labelId = "label-" + (++maxLabelId);
90 listItem.querySelector(".display").setAttribute("id", labelId); 90 var label = listItem.querySelector(".display");
91 label.setAttribute("id", labelId);
92
91 var control = listItem.querySelector(".control"); 93 var control = listItem.querySelector(".control");
92 if (control) 94 if (control)
93 { 95 {
94 // We use aria-labelledby to avoid triggering the control when
95 // interacting with the label
96 control.setAttribute("aria-labelledby", labelId); 96 control.setAttribute("aria-labelledby", labelId);
97 control.addEventListener("click", this.details[j].onClick, false); 97 control.addEventListener("click", this.details[j].onClick, false);
98
99 var role = control.getAttribute("role");
100 if (role == "checkbox" && !label.hasAttribute("data-action"))
101 {
102 var controlId = "control-" + maxLabelId;
103 control.setAttribute("id", controlId);
104 label.setAttribute("for", controlId);
105 }
98 } 106 }
99 107
100 this._setEmpty(table, null); 108 this._setEmpty(table, null);
101 if (table.hasChildNodes()) 109 if (table.hasChildNodes())
102 { 110 {
103 table.insertBefore(listItem, 111 table.insertBefore(listItem,
104 table.childNodes[this.items.indexOf(item)]); 112 table.childNodes[this.items.indexOf(item)]);
105 } 113 }
106 else 114 else
107 table.appendChild(listItem); 115 table.appendChild(listItem);
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 }); 1144 });
1137 ext.backgroundPage.sendMessage( 1145 ext.backgroundPage.sendMessage(
1138 { 1146 {
1139 type: "subscriptions.listen", 1147 type: "subscriptions.listen",
1140 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1148 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1141 "title"] 1149 "title"]
1142 }); 1150 });
1143 1151
1144 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1152 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1145 })(); 1153 })();
OLDNEW
« no previous file with comments | « options.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld