Skip to content

[css-anchor-position-1] Clarify interaction of anchors and positioned elements with content-visibility #10184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vmpstr opened this issue Apr 9, 2024 · 6 comments

Comments

@vmpstr
Copy link
Member

vmpstr commented Apr 9, 2024

In #10040 we've resolved that

... if a positioned element is "relevant to the user", any element it's anchoring to remains "relevant to the user" as well.

This particular phrasing poses some implementation difficulties, since we don't typically track whether an arbitrary element is relevant to the user. We only tend to do that in the context of its effect on content-visibility.

I think this should say the following:

if a positioned element is not skipped, any element it's anchoring to remains "relevant to the user".

since being skipped is something that is imposed on the element by content-visibility. This does mean that if the anchor and the positioned elements are both off-screen, but the positioned element is not under content-visibility, then the anchor will remain relevant to the user. I think that's fine though.

As an aside, I presume that if the positioned element is display: none or something, then it's not actually a positioned element and thus is not anchoring to the anchor

/cc @tabatkins @progers @mfreed7

@vmpstr
Copy link
Member Author

vmpstr commented Apr 9, 2024

An edge case is if the positioned element and the anchor are both in the same content-visibility subtree. Then the positioned element is not skipped, and thus the anchor is relevant. This means that this subtree will always be relevant. We should probably have a carve out for this case to allow it to become skipped

@progers
Copy link
Contributor

progers commented Apr 9, 2024

As an aside, I presume that if the positioned element is display: none or something, then it's not actually a positioned element and thus is not anchoring to the anchor.

Do you mean the scenario where the anchor element itself has display: none? In that case, the spec says that anchor-name only applies to elements that produce a principle box, and this wouldn't happen with display none. Or do you mean the case where the anchored element has display: none; in which case, is the effect observable either way?

@tabatkins
Copy link
Member

I think this should say the following:

I'm fine with this rephrasing.

We should probably have a carve out for this case to allow it to become skipped

Yup, indeed. Gotta prevent cycles in our collector.

As an aside, I presume that if the positioned element is display: none or something, then it's not actually a positioned element and thus is not anchoring to the anchor

Correct.

tabatkins added a commit that referenced this issue Apr 9, 2024
…directly in terms of skipping, rather than making things relevant, as that better maps to the spec concepts. #10184
@tabatkins
Copy link
Member

Okay, text rephrased. Let me know if this works for you, @vmpstr ?

@vmpstr
Copy link
Member Author

vmpstr commented Apr 11, 2024

Looks good.

Minor nit:

... if a descendant of el is a target anchor element for a positioned element who is not skipped ...

"who" here is ambiguous: it could be the target anchor element or a positioned element. The rest of the text continues with

... and whose containing block is not el or a descendant of el, ...

Which strongly suggests that we're talking about the positioned element here, since the target anchor element is a descendant of el from the earlier text. So that's why it's a minor nit.

@vmpstr
Copy link
Member Author

vmpstr commented Apr 11, 2024

I think we can close though, and fix up ambiguities as separate editorial changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants