[Inactive CSS] Display a warning when `display:*` is used on a floated element
Categories
(DevTools :: Inspector: Rules, enhancement, P3)
Tracking
(firefox71 fixed)
Tracking | Status | |
---|---|---|
firefox71 | --- | fixed |
People
(Reporter: miker, Assigned: biboswan98)
References
(Blocks 1 open bug)
Details
(Whiteboard: [Importance: 92.3%])
Attachments
(1 file, 1 obsolete file)
Only non-floated elements:
[
"display",
]
[This property] doesn't have an effect because it cannot be used on floated elements.
Comment 1•5 years ago
|
||
This MDN page is quite useful for display
used on floated elements: https://developer.mozilla.org/en-US/docs/Web/CSS/float
In particular, it mentions which display
values are replaced. Here they are:
- inline --> block
- inline-block --> block
- inline-table --> table
- table-row --> block
- table-row-group --> block
- table-column --> block
- table-column-group --> block
- table-cell --> block
- table-caption --> block
- table-header-group --> block
- table-footer-group --> block
- inline-flex --> flex
- inline-grid --> grid
So, it might be nice top make this rule user-friendly here by doing this:
- if the
display
value is not one from this list, no warning - if it is, show a warning like
The display value has been changed by the engine to block because the element is floated
.
Assignee | ||
Comment 2•5 years ago
|
||
Hi, I would like to work on this. I see that the computed
pane of the devtools shows that the display is block
when the display is declared as something like inline
on a floated element.
Just wanted to be doubly sure that declaration override is only shown for a declaration which is overridden due to another user-defined css declaration. Engine changed styling like the one mentioned here is not depicted by an override.
Reporter | ||
Comment 3•5 years ago
|
||
We have assigned you to the bug... if you have any questions then please don't hesitate to ask.
Updated•5 years ago
|
Comment 4•5 years ago
|
||
Hi Biboswan, how are things going? Are you still interested in this bug?
If not, just let me know since other people might be interested in fixing it too! Thanks.
Assignee | ||
Comment 5•5 years ago
|
||
Hey Patrick, I will send a PR in 1 or 2 days
Assignee | ||
Comment 6•5 years ago
|
||
I wanted to console.log the rules of the inspector. So I edited a rule declaration in devtools and expected to get logs i have put in the action files, components/RulesApp etc in the browser toolbox console. I think some of my assumption is wrong ?
I can easily see corresponding logs or changes i did in the index.xhtml
Reporter | ||
Comment 7•5 years ago
•
|
||
(In reply to Biboswan Roy from comment #6)
I wanted to console.log the rules of the inspector. So I edited a rule declaration in devtools and expected to get logs i have put in the action files, components/RulesApp etc in the browser toolbox console. I think some of my assumption is wrong ?
I can easily see corresponding logs or changes i did in the index.xhtml
console.log
is not always visible in the browser console. Sometimes you need to open the "Browser Content Toolbox" to see the output.
When you ask questions then please also check "Request information from" and choose "reporter" from the dropdown (towards the bottom of this page).
Assignee | ||
Comment 8•5 years ago
|
||
Hi Mike,I wasn't sure whom to ask. I can't see the consoles i put inside reducer
and action
creator functions in the browser toolbox
(Developer Tools- chrome://browser/content/browser.xhtml) Seems like those aren't triggered. So i 'm telling what I did again. I open the nightly build and opened a web page and inspector tools and edited rules of that page. So I expected to see logs due to the UPDATE_RULES
action triggered. I also checked the source code in the debugger and my code changes are visible in the source code. But I don't see any such traces. I tried browser content toolbox
as well.
Thanks for your patience again
Reporter | ||
Comment 9•5 years ago
|
||
The only files you should need to change to implement this are:
- https://searchfox.org/mozilla-central/source/devtools/server/actors/utils/inactive-property-helper.js
- https://searchfox.org/mozilla-central/source/devtools/client/locales/en-US/tooltips.ftl
A good example of adding a similar feature is:
https://phabricator.services.mozilla.com/D31235
Assignee | ||
Comment 10•5 years ago
|
||
Thanks for the direction Mike. My main concern was not able to see the logs. I will check
Assignee | ||
Comment 11•5 years ago
|
||
I 'm implemented the feature. I'm requesting for code review. Who all to request for code reviews as per https://docs.firefox-dev.tools/contributing/making-prs.html what names to include?
Assignee | ||
Comment 12•5 years ago
|
||
Assignee | ||
Comment 13•5 years ago
|
||
I had 2 things to ask.
- I haven't added any testing. Do they exist for these kind of bugs
- Currently the
learn-more
on hover links to the inactive property on which the warning is shown. Eg if shown on display,learn-more
points to mozilla docs @ display. But for this bug i thinkdisplay
is the inactive property but learn-more shall point to float.
Assignee | ||
Comment 14•5 years ago
|
||
Have a look at my concern in the above comment point2
Reporter | ||
Comment 15•5 years ago
|
||
I see, can you log a bug for that to allow us to override the property that we display the info for?
Assignee | ||
Comment 16•5 years ago
|
||
(In reply to Mike Ratcliffe [:miker] [:mratcliffe] [:mikeratcliffe] from comment #15)
I see, can you log a bug for that to allow us to override the property that we display the info for?
Yes sure and I would like to implement that myself as well
Comment 17•5 years ago
|
||
(In reply to Biboswan Roy from comment #8)
Hi Mike,I wasn't sure whom to ask. I can't see the consoles i put inside
reducer
andaction
creator functions inthe browser toolbox
(Developer Tools- chrome://browser/content/browser.xhtml) Seems like those aren't triggered. So i 'm telling what I did again. I open the nightly build and opened a web page and inspector tools and edited rules of that page. So I expected to see logs due to theUPDATE_RULES
action triggered. I also checked the source code in the debugger and my code changes are visible in the source code. But I don't see any such traces. I triedbrowser content toolbox
as well.
Hi Biboswan,
In response to this earlier message, the React/Redux files you're trying to use here aren't the ones for the current Rules panel. They're part of a refactoring that's incomplete and not active yet in DevTools. Everything in: new-rules.js, components/, reducers/ and actions/ is part of this refactoring.
The active code handling the existing Rules panel is in rules.js, models/ and views/. This is where you should observe for events and changes.
Sorry about this confusion.
Reporter | ||
Updated•5 years ago
|
Assignee | ||
Comment 18•5 years ago
|
||
Thanks Razvan
Reporter | ||
Comment 19•5 years ago
•
|
||
@biboswan98 Are you still working on this?
Assignee | ||
Comment 20•5 years ago
|
||
I will look at it today and try to push by tomorrow
Assignee | ||
Comment 21•5 years ago
|
||
Updated•5 years ago
|
Assignee | ||
Comment 22•5 years ago
|
||
Pushed code again. Have a look
Reporter | ||
Comment 23•5 years ago
|
||
@Biboswan Do you have permission to land this? If not just add the checkin-needed keyword and we will land it for you.
Thanks for working on this.
Comment 25•5 years ago
|
||
Pushed by pbrosset@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7be1052a9327 New InactiveCSS rule to show warning when display:* used on a floated element; r=miker,pbro,fluent-reviewers,flod
Comment 26•5 years ago
|
||
bugherder |
Comment 27•5 years ago
|
||
I think inline-flex/grid here need different messages since they are changed to flex/grid as opposed to block.
(In general, the display-outside value will be promoted to block, see https://drafts.csswg.org/css-display/#transformations )
Assignee | ||
Comment 28•5 years ago
|
||
Yes you are right.
Assignee | ||
Comment 29•5 years ago
|
||
So inline-table => table
inline-grid => grid
inline-flex => flex
ruby => block ruby
Then shall there be specific messages for each of these 4 cases. Or provide a generalised message. The engine blockifies the outer display type on a floated element, hence inline-grid is changed to grid, inline-table to table... etc.
Comment 30•5 years ago
|
||
We should keep it rather generic and then point people to the right MDN documentation so they know more.
Comment 31•5 years ago
|
||
(In reply to Patrick Brosset <:pbro> from comment #30)
We should keep it rather generic and then point people to the right MDN documentation so they know more.
The current messages aren't really generic though: "The <strong>display</strong> value has been changed by the engine to <strong>block</strong> because the element is <strong>floated<strong>." and "Try removing <strong>float</strong> or adding <strong>display:block</strong>. { learn-more }".
They might be misleading for inline-flex/grid. Should I file a bug about this ?
Comment 32•5 years ago
|
||
Yes, sorry my answer was a bit short and cryptic. I am in favor of rephrasing the current warning so it is both generic and inclusive of all display types. Feel free to file a bug with a suggestion for a better warning message.
Description
•