Closed Bug 1751417 Opened 4 years ago Closed 4 years ago

only "last" media query from nested media queries is displayed next to the rule

Categories

(DevTools :: Inspector: Rules, defect, P3)

defect

Tracking

(firefox98 fixed)

RESOLVED FIXED
98 Branch
Tracking Status
firefox98 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

References

Details

Attachments

(4 files)

Steps to reproduce

  1. Navigate to data:text/html,<meta charset=utf8><style>@media screen {@media (min-width: 1px) {@media (min-height: 1px) {@media (max-width: 9999px) {@media (max-height: 9999px) {body {background: tomato;}}}}}}</style>Tomato
  2. Open the inspector, select the <body> node, and select the Rule view if it wasn't already
  3. Spot the body {background: tomato;} rule

Expected results

The location has the whole "tree" of nested media queries, or provides a way to see it/indicate there's more than 1 parent rule

Actual results

Only the last media query is displayed (inline:1 @media (max-height: 9999px))


Here's the content of the stylesheet nicely formatted:

@media screen {
  @media (min-width: 1px) {
    @media (min-height: 1px) {
      @media (max-width: 9999px) {
        @media (max-height: 9999px) {
          body {
            background: red;
          }
        }
      }
    }
  }
}

this case is definitely extreme, and showing all the media text would be challenging, but we could find something to indicate that there's more than the last one.

We'll probably have similar issue in how we want to represent nested @layer (even more when they're mixed with media queries)

After bug 1731612 is done, what about displaying the concatenation of all the media queries and layers screen min-width: 1px min-height: 1px max-width: 9999px max-height: 9999px ?
And:

  • text-overflow that the text is croped if too long,
  • tooltip value so that you can see overything on hover.

Here's a very simple version, showing all the different levels on the same line, separated by a simple space.
The information is here, but that isn't really great and won't scale up (although this is definitely an extreme case)
I'll try to give each "level" its own line, maybe capped at 2 or 3 lines, and then showing the whole text in the tooltip

Attached image chrome.png —

Having a dedicated line per media query is what chrome does. Sounds like a decent approach

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

This ensures @media and @layer information can be searched for and properly highlighted
in the rule view.
A test is added to check various cases.

Depends on D136882

Severity: -- → S3
Priority: -- → P3
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d0fa4b583f04 [devtools] Display all ancestor media queries and layers in rule view. r=jdescottes. https://hg.mozilla.org/integration/autoland/rev/ee12a9a90fe0 [devtools] Rule view filtering should handle ancestor rules data. r=jdescottes.
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch
Blocks: 1788030
No longer blocks: 1788030
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: