-
Notifications
You must be signed in to change notification settings - Fork 688
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
[css-anchor-1] Need ability to say "don't render" when anchor is off-screen #7758
Comments
I think JUST add display:none could be jarring as anchors scroll in and out of the visible content. From an Open UI perspective for It might be hard to guess what a good default would be for this, hiding is not a bad idea. Another thought is that maybe sometimes people will want the anchored element to be clipped by the scroll container rather than hidden? |
It could be, or could not be, depending! If your anchors purposely hang out outside of the scroller, tho, you've gotta do something when the anchor is out of the viewport.
I haven't dug deeply enough into OpenUI - can you give me a pointer to hide event stuff?
You can achieve this by putting the positioned element in the same scroller as the anchor. |
Just saw the blog on this and was concerned about this, watching them overlayed outside the container. My custom anchor system uses
Edit: Newer commit |
I have a proposal that's built on top of #8724, which if resolved will allow us to specify a bounding box (not just the CB in positioned layout) for position fallback. Then we can have a new property that controls what to do when the anchored element ends up overflowing that bounding box: position-fallback-overflow: clip | visible
The initial value is Discussion:
|
This is an excellent argument, and a great idea. Yeah, I think being able to clip to the box that you're using for overflow bounds sounds great. Not sure we should default to Okay, so I'm inclined to just go ahead and edit in #8724 and this one. I'll review #8200 as well to see if I want to go ahead and pull it in, too. |
Or hm, maybe we should act as 'clip' if you have a specified -fallback-bound element, and visible if you don't. So the initial value should be an 'auto'. |
I found a real use case for the We can achieve the same by:
|
Would Recording.2023-05-31.215830.mp4 |
This looks like a different thing, which is closer to Floating UI's shift that tries to keep the element in the bounding box without switching position; while this issue is about what to do when it's overflowing the bounding box. And we don't have full support for |
Thinking about this more as I try to write it up - rather than clipping to the overflow box, would it make more sense for the default to be "clip to the bounds of every scroller between you and the specified anchor"? In particular, if there are two scrollers between your CB and your anchor, and the innermost has the anchor in the scrollport but the outer has the entire inner scroller out of the scrollport, you still want to clip, I assume. If we rely on just the overflow box, even if you specify an additional one with anchor-overflow-bounds, it won't be able to capture both boxes. |
I feel like we may still want some consistency between here and #8724. If we use a box for overflow clipping, we would very likely also want to use the same box to trigger position fallback. Then everything gets really complicated if we need to consider a chain of clipping boxes. Imagine if someone wants to use the intersection of the ancestor scrollers of the anchor to trigger position fallback... I don't have a good idea towards this direction. Some thoughts are:
|
Yeah, I definitely agree. I'm talking about an additional clip - in addition (and maybe by default?) clip to the scrollers between the anchor-scroll element and them as well. Multiple values for the clipping property (which we should move to an Like,
I don't think fallback with the scrollers is necessary; the intermediate scrollers don't have any particular reason to be layout-relevant to the positioned element, they're just ways to hide the anchor and thus things that the positioned element probably wants to be hidden by as well. |
|
I'd like to get your input here. Do you think In particular, for each anchor-positioned element, we need to duplicate a bunch of clip nodes from the ancestor scrollers of the anchor. |
Discussed with @wangxianzhu offline. This should be implementable in Chromium The solution doesn't involve duplicating any clip nodes, but we can simply make |
A slightly revised idea:
There's a possibility that in the future, this gets extended into Also 1 Note that we no longer have a separate |
I'm wondering if the default value should be It's pretty common to have a scroller with On the other hand, it can be less confusing when the default value is |
I would say that in my experiments I, sometimes, wanted to have the Also, I imagine clipping would also work for |
I've coded my tooltips to be a psuedo top-layer, so they break through their anchor's boundary. For example, this is anchored to the button, but overlays above the Nav Drawer and its scrollbar on the left: I can simulate a clip by dropping the z-index: An example of "don't render" because the anchor is off-screen is applicable to what I call "semi-sticky" toolbars, where it scrolls aways on scroll down, but stickied on scroll up. If the keyboard is focused on a toolbar button, the tooltip is shown. But when the toolbar button is no longer more than 50%, then it meets my custom threshold of being "off-screen" and I close the tooltip. And mid-hide when scrolling down: The consequence of not doing this is the issue we know where a tooltip can appear when it shouldn't: I'm using intersection observer on the anchor as well as on the tooltip itself. Because the tooltip isn't useful without what it's giving a tip for, I want it on the anchor. But there could be an instance where the tooltip gets occluded (eg: forced position) and then I want it to hide instead of reposition when partially occluded. I'm unsure what |
For example:
Then |
Yeah, it basically gives you back the clipping that you would have if your positioned element was an abspos next to the anchor. Being able to have your positioned element elsewhere in the page is a big part of what makes anchor positioning powerful.
Yes, overflow:hidden is a scroller so it would act identically to overflow:scroll. |
@xiaochengh Will |
@yisibl Yes, but I don't have a clear idea how it should work. Anyway, it's better to file a separate issue for it. |
The spec issue: w3c/csswg-drafts#7758 is up for discussion, with the hope that the currently-proposed spec text is approved. Bug: 40947467 Change-Id: I8ee2510ab3da3b05f800cc50caee60b489446e01
The spec issue: w3c/csswg-drafts#7758 is up for discussion, with the hope that the currently-proposed spec text is approved. Bug: 40947467 Change-Id: I8ee2510ab3da3b05f800cc50caee60b489446e01
The spec issue: w3c/csswg-drafts#7758 is up for discussion, with the hope that the currently-proposed spec text is approved. Bug: 40947467 Change-Id: I8ee2510ab3da3b05f800cc50caee60b489446e01
The CSS Working Group just discussed The full IRC log of that discussion<chrishtr> TabAtkins: this is a call for review on the details of position-visibility as defined in the ED spec<chrishtr> TabAtkins: there was a previous resolution for the feature, but some details have been filled in <chrishtr> TabAtkins: call to please review and otherwise we'll consider the ED spec text accepted |
The spec issue: w3c/csswg-drafts#7758 was resolved, edits made to the spec, and no objections heard at CSSWG. Bug: 40947467 Change-Id: I8ee2510ab3da3b05f800cc50caee60b489446e01
The spec issue: w3c/csswg-drafts#7758 was resolved, edits made to the spec, and no objections heard at CSSWG. Bug: 40947467 Change-Id: I8ee2510ab3da3b05f800cc50caee60b489446e01 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5436909 Reviewed-by: Philip Rogers <[email protected]> Commit-Queue: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1285272}
The spec issue: w3c/csswg-drafts#7758 was resolved, edits made to the spec, and no objections heard at CSSWG. Bug: 40947467 Change-Id: I8ee2510ab3da3b05f800cc50caee60b489446e01 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5436909 Reviewed-by: Philip Rogers <[email protected]> Commit-Queue: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1285272}
The spec issue: w3c/csswg-drafts#7758 was resolved, edits made to the spec, and no objections heard at CSSWG. Bug: 40947467 Change-Id: I8ee2510ab3da3b05f800cc50caee60b489446e01 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5436909 Reviewed-by: Philip Rogers <[email protected]> Commit-Queue: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1285272}
The spec issue: w3c/csswg-drafts#7758 was resolved, edits made to the spec, and no objections heard at CSSWG. Bug: 40947467 Change-Id: I8ee2510ab3da3b05f800cc50caee60b489446e01 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5436909 Reviewed-by: Philip Rogers <[email protected]> Commit-Queue: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1285272}
…ion for position-visibility: anchors-valid, a=testonly Automatic update from web-platform-tests [css-anchor-position] Simple implementation for position-visibility: anchors-valid Due to the complexity to implement the original proposal of position-visibility: anchors-valid and anchors-visible in w3c/csswg-drafts#7758 (comment), we have proposed a simple implementation w3c/csswg-drafts#7758 (comment) and this implementation is based on the simple proposal. Bug: 329703412 Change-Id: I7ac5d9bfbd5a3c89822567ffa6701cc66959b665 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5406199 Reviewed-by: Philip Rogers <[email protected]> Commit-Queue: Xianzhu Wang <[email protected]> Cr-Commit-Position: refs/heads/main@{#1280441} -- wpt-commits: f401f6100e5dcf03da047fd6164fa5132064ef13 wpt-pr: 45424
…tion-visibility: anchors-visible, a=testonly Automatic update from web-platform-tests [css-anchor-position] Support basic position-visibility: anchors-visible This patch implements basic support for position-visibility: anchors-visible with a single anchor. There is active discussion about whether to track the visibility of multiple anchors at: w3c/csswg-drafts#7758 (comment). The high-level approach in this patch is to use a post-layout intersection observer for the tracked anchor. On visibility changes, the anchored element's paint layer is updated via `PaintLayer::SetInvisibleForPositionVisibility`. Spec: w3c/csswg-drafts#7758 (comment) Bug: 329703412 Change-Id: Icedcb43510a0c6a491cf463e7dc8a114ab7abf5f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5410539 Commit-Queue: Xianzhu Wang <[email protected]> Auto-Submit: Philip Rogers <[email protected]> Reviewed-by: Xianzhu Wang <[email protected]> Cr-Commit-Position: refs/heads/main@{#1281911} -- wpt-commits: 6673c544f6ecefa1e89dcd47db63b1c43a29396f wpt-pr: 45451
…lity for anchors-visible, a=testonly Automatic update from web-platform-tests [css-anchor-position] Support CSS visibility for anchors-visible We previously supported position-visibility: anchors-visible only for the "intersection visibility" of the anchor element. This patch extends anchors-visible to also be based on the CSS visibility of the anchor element. Implementation notes: * CSS visibility of anchor elements can change without notifying the anchored element. To catch these style changes, we loop over all used anchor elements every lifecycle update with `LocalFrame::CheckPositionAnchorsForCssVisibilityChanges`. * LayerPositionVisibility has been introduced to support the two aspects of anchors-visible visibility. These can be tracked independently. Spec: w3c/csswg-drafts#7758 (comment) Bug: 332663437 Change-Id: Id043217fb33308c7af35a3d9fbe103a5c552a34a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5425736 Reviewed-by: Xianzhu Wang <[email protected]> Commit-Queue: Philip Rogers <[email protected]> Cr-Commit-Position: refs/heads/main@{#1282626} -- wpt-commits: 9417ab6082dc381eda5c3ef4f198c6a8cce03fe7 wpt-pr: 45550
…position-visibility: no-overflow, a=testonly Automatic update from web-platform-tests [css-anchor-position] Basic support for position-visibility: no-overflow w3c/csswg-drafts#7758 (comment) no-overflow hides the abspos if it overflows its inset-modified containing block (after exhausting all position-try options, if relevant). Note this value would apply even when using regular abspos or fixedpos. PaintLayer::SetInvisibleForPositionVisibility to track if the layer needs to be invisible for any position-visibility constraint. The function is called when the abspos needs to be invisible due to no-overflow. The layer, as well certain descendant layers [1] in containing block hierarchy will be skipped during hit-testing and paint. [1] We should skip all descendant layers in containing block hierarchy, but this CL fails to skip self-painting descendant layers if the layer is not a stacking context. The issue will be addressed in a followup. Bug: 329703412 Change-Id: Iee50ef89fbdb6a4c514b1940c45b0d9c41220383 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5398471 Reviewed-by: Philip Rogers <[email protected]> Commit-Queue: Xianzhu Wang <[email protected]> Cr-Commit-Position: refs/heads/main@{#1279183} -- wpt-commits: f1d83c9438a4efaf226ec445d23d88bb1bc708ad wpt-pr: 45364
…ion for position-visibility: anchors-valid, a=testonly Automatic update from web-platform-tests [css-anchor-position] Simple implementation for position-visibility: anchors-valid Due to the complexity to implement the original proposal of position-visibility: anchors-valid and anchors-visible in w3c/csswg-drafts#7758 (comment), we have proposed a simple implementation w3c/csswg-drafts#7758 (comment) and this implementation is based on the simple proposal. Bug: 329703412 Change-Id: I7ac5d9bfbd5a3c89822567ffa6701cc66959b665 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5406199 Reviewed-by: Philip Rogers <[email protected]> Commit-Queue: Xianzhu Wang <[email protected]> Cr-Commit-Position: refs/heads/main@{#1280441} -- wpt-commits: f401f6100e5dcf03da047fd6164fa5132064ef13 wpt-pr: 45424
…tion-visibility: anchors-visible, a=testonly Automatic update from web-platform-tests [css-anchor-position] Support basic position-visibility: anchors-visible This patch implements basic support for position-visibility: anchors-visible with a single anchor. There is active discussion about whether to track the visibility of multiple anchors at: w3c/csswg-drafts#7758 (comment). The high-level approach in this patch is to use a post-layout intersection observer for the tracked anchor. On visibility changes, the anchored element's paint layer is updated via `PaintLayer::SetInvisibleForPositionVisibility`. Spec: w3c/csswg-drafts#7758 (comment) Bug: 329703412 Change-Id: Icedcb43510a0c6a491cf463e7dc8a114ab7abf5f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5410539 Commit-Queue: Xianzhu Wang <[email protected]> Auto-Submit: Philip Rogers <[email protected]> Reviewed-by: Xianzhu Wang <[email protected]> Cr-Commit-Position: refs/heads/main@{#1281911} -- wpt-commits: 6673c544f6ecefa1e89dcd47db63b1c43a29396f wpt-pr: 45451
…lity for anchors-visible, a=testonly Automatic update from web-platform-tests [css-anchor-position] Support CSS visibility for anchors-visible We previously supported position-visibility: anchors-visible only for the "intersection visibility" of the anchor element. This patch extends anchors-visible to also be based on the CSS visibility of the anchor element. Implementation notes: * CSS visibility of anchor elements can change without notifying the anchored element. To catch these style changes, we loop over all used anchor elements every lifecycle update with `LocalFrame::CheckPositionAnchorsForCssVisibilityChanges`. * LayerPositionVisibility has been introduced to support the two aspects of anchors-visible visibility. These can be tracked independently. Spec: w3c/csswg-drafts#7758 (comment) Bug: 332663437 Change-Id: Id043217fb33308c7af35a3d9fbe103a5c552a34a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5425736 Reviewed-by: Xianzhu Wang <[email protected]> Commit-Queue: Philip Rogers <[email protected]> Cr-Commit-Position: refs/heads/main@{#1282626} -- wpt-commits: 9417ab6082dc381eda5c3ef4f198c6a8cce03fe7 wpt-pr: 45550
Should we rename |
…tive, a=testonly Automatic update from web-platform-tests Mark position-visibility tests non-tentative The spec issue: w3c/csswg-drafts#7758 was resolved, edits made to the spec, and no objections heard at CSSWG. Bug: 40947467 Change-Id: I8ee2510ab3da3b05f800cc50caee60b489446e01 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5436909 Reviewed-by: Philip Rogers <[email protected]> Commit-Queue: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1285272} -- wpt-commits: 5baae3e11208b54b1bf11a0e7c67f6abb0cf0651 wpt-pr: 45620
…tive, a=testonly Automatic update from web-platform-tests Mark position-visibility tests non-tentative The spec issue: w3c/csswg-drafts#7758 was resolved, edits made to the spec, and no objections heard at CSSWG. Bug: 40947467 Change-Id: I8ee2510ab3da3b05f800cc50caee60b489446e01 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5436909 Reviewed-by: Philip Rogers <[email protected]> Commit-Queue: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1285272} -- wpt-commits: 5baae3e11208b54b1bf11a0e7c67f6abb0cf0651 wpt-pr: 45620
Can anyone provide an example for how to make appear/leave transitions or animations work? And do I understand correctly that this is not possible as of yet? |
I don't think this is possible yet, see: #10182 |
Consider: an anchor is inside of a scroll container. The positioned element is outside of the scroll container. This is legit if you want the positioned element, when visible, to be able to project outside of the scrollable area, such as into the margin.
However, this then means that if the anchor is scrolled outside of the scrollport, the positioned element just hovers above or below the scroll container, wherever the anchor is theoretically positioned. That is almost certainly not what you want!
So we should have some way to specify that if the anchor is off-screen, the positioned element should hide itself.
Questions:
The text was updated successfully, but these errors were encountered: