Closed
Bug 1617672
Opened 4 years ago
Closed 4 years ago
Avoid outputting filter category as an unprefixed class on filter buttons
Categories
(DevTools :: Console, task, P3)
DevTools
Console
Tracking
(firefox75 fixed)
RESOLVED
FIXED
Firefox 75
Tracking | Status | |
---|---|---|
firefox75 | --- | fixed |
People
(Reporter: fvsch, Assigned: i, Mentored)
Details
(Keywords: good-first-bug)
Attachments
(1 file, 1 obsolete file)
Bug 1617672 - Avoid outputting filter category as an unprefixed class on filter buttons. r=nchevobbe
47 bytes,
text/x-phabricator-request
|
Details | Review |
We're generating this DOM for filter buttons:
<button aria-pressed="true" class="devtools-togglebutton error">
Errors
</button>
where the second class is one of these values:
const FILTERS = {
CSS: "css",
DEBUG: "debug",
ERROR: "error",
INFO: "info",
LOG: "log",
NET: "net",
NETXHR: "netxhr",
TEXT: "text",
WARN: "warn",
};
This means we have elements with super generic classes like "error", "info", "log", or "text", and any somewhat rogue style that would target one of these could break the toolbar styles.
On top of that, those classes are awkward to work with:
/* devtools/client/webconsole/test/browser/head.js#getFilterState */
for (const button of buttons) {
const classes = new Set(button.classList.values());
classes.delete("devtools-togglebutton");
const category = classes.values().next().value;
result[category] = button.getAttribute("aria-pressed") === "true";
}
We could use a data attribute instead:
<button aria-pressed="true" class="devtools-togglebutton" data-category="error">
Errors
</button>
which simplifies the above code:
for (const button of buttons) {
result[button.dataset.category] = button.getAttribute("aria-pressed") === "true";
}
Comment 1•4 years ago
|
||
Thanks for filing Florens, I totally agree with you.
Updated•4 years ago
|
Assignee: nobody → i
Status: NEW → ASSIGNED
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3eb6676c83ad Avoid outputting filter category as an unprefixed class on filter buttons. r=nchevobbe
Comment 5•4 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
status-firefox75:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 75
Updated•4 years ago
|
Attachment #9129365 -
Attachment is obsolete: true
You need to log in
before you can comment on or make changes to this bug.
Description
•