Evaluate visibility of anchor element (position-visibility: anchors-visible)
Categories
(Core :: Layout: Positioned, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox147 | --- | fixed |
People
(Reporter: dshin, Assigned: emilio)
References
(Blocks 1 open bug)
Details
(Whiteboard: [anchorpositioning:m3], [wptsync upstream])
Attachments
(1 file)
position-visibility: anchors-visible requires this.
May amount to something similar to content-visibility: auto, but focus is not taken into account, just if the anchor element is clipped out.
Updated•1 year ago
|
| Reporter | ||
Comment 1•8 months ago
|
||
Follows a specific definition of the anchor being visible: "If the box has a default anchor box but that anchor box is clipped by intervening boxes, this box is also strongly hidden."
Where "clipped by intervening boxes" is "An anchor box anchor is clipped by intervening boxes relative to a positioned box abspos relying on it if anchor’s ink overflow rectangle is fully clipped by a box which is an ancestor of anchor but a descendant of abspos’s containing block." So we need an additional check here beyond getting the right anchor.
Should also be noted that it only cares about the default anchor box - It doesn't matter if it ends up being used (e.g. position-anchor: --foo; left: anchor(--bar, right) only cares about the visibility of --foo, not --bar).
| Reporter | ||
Updated•7 months ago
|
| Reporter | ||
Comment 2•7 months ago
|
||
This work will be done at ResizeObserver event time, within the framework provided by Bug 1962471
Updated•4 months ago
|
| Assignee | ||
Updated•3 months ago
|
| Assignee | ||
Comment 3•3 months ago
|
||
So my read of the whole position-visibility thing is that it's supposed to happen during layout of the anchored box, not at ResizeObserver time. I'm not convinced that's a great idea for position-visibility: anchors-visible, but I filed https://github.com/web-platform-tests/interop/issues/998 / https://github.com/w3c/csswg-drafts/issues/12732 about it.
| Assignee | ||
Comment 4•3 months ago
|
||
From conversations with David, I think the idea this bug was to start using the ResizeObserver timing for position-visibility, but reading some of the context of position-visibility, it seems the intention is for it to be done during layout (that's why anchors-visible only checks overflow of the intermediate containing blocks, rather than something more interesting like IntersectionObserver).
That said, the whole state of that seems rather sad. There's not a single test for force-hidden whatsoever, and I'm not convinced the proposed behavior is great: https://github.com/w3c/csswg-drafts/issues/12732 / https://github.com/web-platform-tests/interop/issues/998
I tend to agree that this should ideally use that timing to be a bit more sophisticated, but I don't think we want to go ahead with that without getting the spec sorted out first.
Comment 5•2 months ago
|
||
Yeah, that seems right. Thanks for digging into this to get us more clarity.
Updated•2 months ago
|
| Reporter | ||
Updated•2 months ago
|
| Reporter | ||
Updated•2 months ago
|
Updated•2 months ago
|
Comment 6•2 months ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #4)
As you know (but just to transfer the information here), it seems that Chrome uses their intersection observer code for this, but runs it in the resize observer loop just prior to the resize observers.
https://github.com/w3c/csswg-drafts/issues/12732#issuecomment-3255974085
In the following comment on the github issue you seem positive about that approach. This bug seems very important to being able to ship so, given that, would you be willing to work on this while the spec work is in progress (under the assumption if Chrome and we both align on the same behavior we can get that spec'ed)?
| Assignee | ||
Comment 7•2 months ago
|
||
This bug seems very important to being able to ship
Is it? I was assuming shipping without anchors-visible support wouldn't be a huge deal? It was a relatively late addition to the spec.
would you be willing to work on this while the spec work is in progress (under the assumption if Chrome and we both align on the same behavior we can get that spec'ed)?
Well WebKit seems to thing the current spec (which uses a totally different approach) is fine, so I'd personally rather wait before implementing one thing and then switching to another. It doesn't seem particularly terrible to implement either way tho, it's just very different...
Updated•2 months ago
|
Updated•2 months ago
|
| Reporter | ||
Comment 8•2 months ago
|
||
To clarify - this ticket specifically concerns position-visibility: anchors-visible, where we:
- Evaluate anchors that are no longer visible (i.e. "clipped by intervening boxes")
- Map affected anchors to relevant positioned elements (i.e. Has affected anchor as default anchor) that have
position-visibility: anchors-visible - Update affected positioned frames' visibility flag (Bug 1962471)
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
| Assignee | ||
Comment 9•4 days ago
|
||
There's one scrolling issue I need to sort out, but this is good enough
for an initial pass.
Updated•4 days ago
|
Comment 10•3 days ago
|
||
| Assignee | ||
Updated•3 days ago
|
Comment 11•3 days ago
|
||
Comment 14•3 days ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/862548b90dc0
https://hg.mozilla.org/mozilla-central/rev/c91d6e83f153
Description
•