Style hint for "max-width" wrongly triggers on block element
Categories
(DevTools :: Inspector: Rules, defect)
Tracking
(Not tracked)
People
(Reporter: krinkle, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:72.0) Gecko/20100101 Firefox/72.0
Steps to reproduce:
An element has the following styling:
display: block;
content: attr(title);
background: #fff;
color: #252525;
border: 1px solid #a7d7f9;
border-radius: 4px;
padding: 5px 8px;
max-width: 20em;
position: absolute;
Actual results:
The following style hint is triggered on the max-width rule:
max-width has no effect on this element since it has a display of inline.
Try adding display:inline-block or display:block. Learn more.
https://developer.mozilla.org/en-US/docs/Web/CSS/max-width
Expected results:
The element has display: block and position: absolute applied. It seems the absolute position is what causes it to think it is an inline element. I'm unsure whether that is true or not implementation-wise (I thought it made elements behave line an inline-block element).
In any event, the "max-width" rule definitely does work on the element in question. A larger title value causes it to wrap, at 20em, as intended.
| Reporter | ||
Comment 1•5 years ago
|
||
I'm not sure but the following might be related:
https://bugzilla.mozilla.org/show_bug.cgi?id=253844
Updated•5 years ago
|
Comment 2•5 years ago
|
||
I have tested this in Firefox 72, 73 and 74, but could not reproduce the problem.
I used the piece of CSS code you provided and created this demo page:
https://jsbin.com/pohucixego/edit?html,css,output
For me the max-width property is always valid.
Could you please check if it works for you with this test page? And if it does, why did it fail for you originally? Did your original test page differ from mine?
| Reporter | ||
Comment 3•5 years ago
|
||
I created an isolated test case at https://codepen.io/Krinkle/pen/bGNMqbV.
What I found is that it is not strictly triggered by position: absolute; being present.
Rather, what triggers it is that the style rule changes.
- Load the code pen.
- Enable the position rule. (The "max-width" style violation now becomes visible.)
- Re-disable the position rule. (The "max-width" style violation remains visible.)
I can reproduce it in reverse as well, e.g. if position:absolute is already set, then removing it makes the style violation visible, and it remains visible even after re-enabing it.
I can also reproduce it on Patrick's JSBin.
| Reporter | ||
Comment 4•5 years ago
|
||
Comment 5•5 years ago
|
||
I'm sorry Krinkle but I still can't reproduce the issue. It works fine for me on your codepen and on my jsbin.
I must be doing something different than you. Could you please list, with all the details, the steps you took to see the bug.
I personally did this:
- open the codepen
- open the inspector
- pick the
<span class="cvn-overlay-pagesub cvn-overlay-pagesub--portlet">element in the inspector - add the
hoverpseudo-class to it (right click on the element in the inspector) - select the
::afterpseudo-element that appeared - inside the Rules panel, disable the
position: absolutedeclaration ==> Themax-widthproperty remains valid at this point - re-enable the
position: absolutedeclaration ==> Themax-widthproperty is still valid
| Reporter | ||
Comment 6•5 years ago
|
||
I didn't know about the "Change Pseudo-class" context menu. I toggled it via the ":hov" menu on the top right of the Rules sidebar in the inspector.
However, either way, I can no longer reproduce this on the codepen, nor on JSBin, nor with the original Wikipedia feature where I first encountered it. A mystery indeed.
Description
•