Closed Bug 1553127 Opened 5 years ago Closed 5 years ago

[Inactive CSS] Display a warning when `place-*` is used incorrectly

Categories

(DevTools :: Inspector: Rules, enhancement, P2)

enhancement

Tracking

(firefox69 verified)

VERIFIED FIXED
Firefox 69
Tracking Status
firefox69 --- verified

People

(Reporter: pbro, Assigned: nchevobbe)

References

(Blocks 1 open bug)

Details

(Whiteboard: [Importance: 0.7%])

Attachments

(3 files)

place-self, place-items and place-content can only be used on or in grid/flex layout containers (at least today), so warnings need to be displayed in the inactive CSS tooltips when they are used elsewhere.
We currently display warnings for the align-* and justify-* properties, but we should do the same for place-*.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Attached image image.png

Correct me if I'm wrong, but I think place-self can be used on flex and grid items.
What's interesting though, is that on flex items, the second value will be ignored (since justify-self can't be used on flex item), but we don't have a UI for that on the inspector UI.

Maybe we could have something like that to start with?

place-self: ▼ center center
    align-self: center;
    justify-self: center ⓘ;

We could also have it directly next to the second value, greyed out? I guess that might be confusing for people

place-self: ▼ center center ⓘ 
    align-self: center;
    justify-self: center ⓘ;

We take this as an opportunity to add tests for align-self as well.
This requires the test to change a bit so we can create more than one
element in order to test the inactive property helper on grid/flex item
(i.e. with a parent flex/grid container).
This is done by providing a createTestElement function in the test case,
which takes the document as a parameter, creates whatever nodes it need,
and returns an object with 2 properties:

  • elementToInsert will be the node that will be inserted in the document
  • elementToTest will be the node we check isPropertyUsed on.

(In reply to Nicolas Chevobbe [:nchevobbe] from comment #1)

Correct me if I'm wrong, but I think place-self can be used on flex and grid items.
What's interesting though, is that on flex items, the second value will be ignored (since justify-self can't be used on flex item)
Good point, that is correct.

Maybe we could have something like that to start with?

place-self: ▼ center center
    align-self: center;
    justify-self: center ⓘ;

We could also have it directly next to the second value, greyed out? I guess that might be confusing for people

place-self: ▼ center center ⓘ 
    align-self: center;
    justify-self: center ⓘ;

So, as an initial thing, I would probably not worry about this case yet. I would display the warning when place-self is used on something where it is not supported at all. But if it is supported, even partially, lile on flex items, I wouldn't display the warning.
In this initial phase of this feature, I'd prefer if we added warnings not too eagerly until we are comfortable with how the feature works, and how maintainable it is on the long run.

Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9ce8678568c4
Display a warning when `place-self` is used on non flex/grid items. r=pbro.
https://hg.mozilla.org/integration/autoland/rev/751af6638b4b
Display a warning when place-items or place-content is used on non flex/grid container. r=pbro.
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 69

Confirming with 69.0b4 that the place-* (self, items, content) rules are properly marked as inactive.

Status: RESOLVED → VERIFIED
Whiteboard: [Importance: 0.7%]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: