Re: [csswg-drafts] [css-anchor-1] Need ability to say "don't render" when anchor is off-screen (#7758)

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:

```css
position-fallback-overflow: clip | visible
```

`clip` means the anchored element should be clipped by the bounding box. `visible` means no such clipping.

The initial value is `clip`.

---

Discussion:

1. I think using the position fallback bounding box is more natural than checking whether the anchor is off screen (or off any box). And it doesn't have any issue with multiple anchors.

2. Clipping seems to provide a better/smoother UX than hiding & showing. User probably don't want to see the element suddenly disappear when something is just slightly off screen.

3. The UX can be even smoother if we have #8200

4. Clipping seems more friendly to the rendering pipeline than hiding/showing, because we are just introducing a clip box.

5. Agreed that it should be activated by default. But it might be just safer to also provide an opt-out. (and it also means I don't need to massively rewrite all the existing WPT)

6. I don't think it should fire any event on its own. `IntersectionObserver` should be good enough, at least for now.


-- 
GitHub Notification of comment by xiaochengh
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7758#issuecomment-1568911631 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 30 May 2023 18:47:52 UTC