[csswg-drafts] [css-anchor-1] Allow anchoring to a particular fragment (#8895)

xiaochengh has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-anchor-1] Allow anchoring to a particular fragment ==
When an element is fragmented across lines/columns, the [current spec](https://drafts.csswg.org/css-anchor-position-1/#ref-for-target-anchor-element%E2%91%A0) says we can only anchor to the axis-aligned bounding box of its fragments. But sometimes we want to anchor to the first/last fragment instead.

For some real world use cases, if we have selected a few lines of text:
- When we press the context menu button, the context menu is anchored to the first fragment
- On touch devices, the selection handles are anchored to the first and last fragments

Floating UI supports this: https://floating-ui.com/docs/inline

How about adding an additional parameter to `anchor()` and `anchor-size()` to specify which fragment to anchor to? For example:

```
anchor(--foo first left)
anchor(--bar last right)
anchor(--baz bounding-box top)
```

And the default value is `bounding-box`

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8895 using your GitHub account


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

Received on Thursday, 1 June 2023 00:53:34 UTC