Open tabatkins opened 1 year ago
Agenda+ to confirm my proposal above - offset-position: auto
resolves to the point in the element specified by offset-anchor
, rather than the top-left corner of the element, so the box doesn't move from its current position by default.
The CSS Working Group just discussed [motion-1] offset-anchor:auto is nonsensical
, and agreed to the following:
RESOLVED: offset-position: auto uses offset-anchor point
Currently, the spec for
offset-position: auto
specifies that the starting point for the offset path is the top-left corner of the box.When this interacts with a non-auto 'offset-anchor', this gives bad behavior - it becomes impossible to start a path from the box's original position. Instead, the box shifts slightly, to align its anchor with where its top-left corner was originally.
The first example in https://drafts.fxtf.org/motion-1/#offset-position-property shows that this is indeed the intended behavior - the green box is first abspos'd 80px to the right and 100px down, then its anchor-position (which is
center
) kicks in and the box shifts 40px left and 50px up so that its center point is at that (80, 100) point.I suspect this is a weird leftover of when this spec was defined in terms of abspos rather than transforms. The (imo) clearly superior behavior for
offset-position: auto
would be to just use the anchor position itself, so atoffset-distance: 0%
the box just... stays exactly where it is.Do we think this is possible to change? The only offset path that pays attention to offset-position is ray(), so maybe the change is minimal in practice?
(Again, the core use-case for ray() is positioning things around a round clock face. Using
position: absolute; top: 50%; left: 50%; offset-anchor: center;
would work for this in the current spec; in the fixed spec you'd instead writeoffset-position: center; offset-anchor: center;
. The old way would still mostly work, it would just start the rays slightly off-center.)