Some selected nodes are hard to read in the markup view
Categories
(DevTools :: Inspector, defect, P3)
Tracking
(firefox84 verified, firefox85 verified)
People
(Reporter: jdescottes, Assigned: manekenpix)
Details
(Keywords: good-first-bug)
Attachments
(2 files)
STRs:
- open a page with hidden iframe (eg https://jdescottes-hiddeniframe.glitch.me/)
- open inspector
- expand the iframe
- select the "#document" element
Expected result: The text #document should be readable
Actual result: The text color is not updated and is hard to read against the blue background
| Reporter | ||
Comment 1•2 years ago
|
||
| Reporter | ||
Comment 2•2 years ago
|
||
I guess this affects only #document, #document-fragment and #shadow-root tags
| Reporter | ||
Comment 3•2 years ago
|
||
This seems to be a simple CSS issue:
https://searchfox.org/mozilla-central/rev/524bed6dfbc5ae21c62632d83b7573448b29e0ac/devtools/client/themes/markup.css#406-419
.not-displayed .tag {
color: var(--markup-hidden-tag-color);
}
/* Selected nodes in the tree should have light selected text.
theme-selected doesn't work in this case since the text is a
sibling of the class, not a child. */
.theme-selected ~ .editor,
.theme-selected ~ .editor.comment,
.theme-selected ~ .editor .theme-fg-color1,
.theme-selected ~ .editor .theme-fg-color2,
.theme-selected ~ .editor .theme-fg-color3 {
color: var(--theme-selection-color);
}
Most elements of the markup view have either .comment or .theme-fg-color1, .theme-fg-color2, .theme-fg-color3 applied, which has higher precedence than their .not-displayed rule. However this is not the case for the #document nodes. Their markup is just
<span xmlns="http://www.w3.org/1999/xhtml" class="tag" tabindex="-1">#document</span>
So the selectors that apply are .not-displayed .tag and .theme-selected ~ .editor. Sibling selectors count as single class selectors, so .not-displayed .tag has high precedence. We should either add another classname or fix the CSS.
Comment 4•2 years ago
|
||
It's not a specificity or precedence issue exactly, it's that we have this DOM structure:
<span class="editor">
<span class="tag" tabindex="0">#document</span>
</span>
To also match the .tag child, we could add this selector to the list:
.theme-selected ~ .editor,
.theme-selected ~ .editor.comment,
+.theme-selected ~ .editor .tag,
.theme-selected ~ .editor .theme-fg-color1,
.theme-selected ~ .editor .theme-fg-color2,
.theme-selected ~ .editor .theme-fg-color3 {
color: var(--theme-selection-color);
}
Comment 5•2 years ago
|
||
A small example to explain the order of inheritance versus specificity:
<style>
/* 0,0,1 specificity */
span {
color: green;
}
/* 1,3,0 specificity */
#container.big.bad.wolf {
color: red !important;
}
</style>
<div id="container" class="big bad wolf">
<span>I'm going to be green, not red</span>
</div>
| Reporter | ||
Comment 6•2 years ago
|
||
Ah good point, I missed that!
| Reporter | ||
Comment 7•2 years ago
|
||
Adding good first bug, the fix is suggested in comment 4, the file to update is https://searchfox.org/mozilla-central/source/devtools/client/themes/markup.css#414
Hi! I'm happy to take this on. As a first time contributor I'll need a little direction on how to get setup and the process for submitting the fix. Is there a guide somewhere I can look at?
| Reporter | ||
Comment 9•2 years ago
|
||
Hi Josh! Thanks for offering to work on this, assigning the bug to you :)
Is there a guide somewhere I can look at?
You can take a look at https://docs.firefox-dev.tools/ for the DevTools developer guide.
It will explain how to get the code, build Firefox and test your changes.
However, when you are ready to submit a patch I advise to switch to https://moz-conduit.readthedocs.io/en/latest/phabricator-user.html which has much more accurate information on how to setup the code review tools, how to submit your patch etc...
And if you have any question, you can find us on Slack at https://devtools-html-slack.herokuapp.com/ or you can use the "Request information from" checkbox, just below the comment box.
Comment 10•2 years ago
|
||
Wonderful, thanks for the direction! I'll be able to take a look this weekend.
Comment 11•1 year ago
|
||
Hi Josh, just checking in on this bug, since there hasn't been activity over the past 2 months.
Are you still interested in working on it?
Please let us know so we can make it available to others if needed.
Comment 12•1 year ago
|
||
(In reply to Patrick Brosset <:pbro> from comment #11)
Hi Josh, just checking in on this bug, since there hasn't been activity over the past 2 months.
Are you still interested in working on it?
Please let us know so we can make it available to others if needed.
So sorry! I completely forgot about this. I don't think I'll be able to get to it in the next few weeks either. Please assign it to someone else. Apologies!
Updated•1 year ago
|
Comment 13•1 year ago
|
||
Hi! I would love to give this issue a go and make my first contribution to Mozilla if this issue hasn't been resolved yet.
Comment 14•1 year ago
|
||
Thanks Maria for your interest. The bug is yours!
Please take a look at comment 9 for how to get started. And then comment 3, comment 4 and comment 5 to know what to change in order to fix this bug.
Please don't hesitate to post comments here to ask any questions you may have.
Comment 15•1 year ago
|
||
Thank you for the guidance! I'll be sure to update you on my progress and ask more questions if I have any.
Comment 16•1 year ago
|
||
Hi Maria, any updates on this? Do you have any problems or questions we could help you with?
Comment 17•1 year ago
|
||
Hi Patrick, my apologies for the delay! I had some trouble setting up my development environment but I'll be working on this bug this week. I'll update you on my progress by the end of the week and I'll be sure to let you know if I come across any problems.
Hi Maria, are you still interested in fixing this bug? Please don't hesitate to ask questions if you need any help.
Honza
| Reporter | ||
Comment 19•9 months ago
|
||
We can probably unassign this one.
Updated•9 months ago
|
| Assignee | ||
Comment 20•9 months ago
|
||
I'd like to work on this one.
| Reporter | ||
Comment 21•9 months ago
|
||
(In reply to manekenpix from comment #20)
I'd like to work on this one.
Thanks, assigning this bug to you.
If you need help to get started, you can either contact us by posting a comment here (use the "Request information from" checkbox below to make sure we are notified), or join our public chat room at https://chat.mozilla.org/#/room/#devtools:mozilla.org
| Assignee | ||
Comment 22•7 months ago
|
||
| Assignee | ||
Comment 23•7 months ago
|
||
I added the suggested fix in comment 4.
Please let me know if there's anything else I can do.
| Assignee | ||
Comment 24•7 months ago
|
||
(In reply to manekenpix from comment #23)
I added the suggested fix in comment 4.
Please let me know if there's anything else I can do.
| Assignee | ||
Comment 25•7 months ago
|
||
Sorry about that last comment.
Updated•7 months ago
|
| Reporter | ||
Updated•7 months ago
|
Comment 26•7 months ago
|
||
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/244e500071c2 Fixed selected nodes are hard to read in markup view r=jdescottes
Comment 27•7 months ago
|
||
| bugherder | ||
Updated•7 months ago
|
Comment 28•6 months ago
|
||
I managed to reproduce the issue using an older version of Nightly on macOS 10.13. I retested everything on the same OS using Firefox 84.0 and Nightly 85.0a1. The issue is not reproducing anymore.
Description
•