- From: Kiet Ho via GitHub <noreply@w3.org>
- Date: Wed, 01 Oct 2025 21:19:51 +0000
- To: public-css-archive@w3.org
tuankiet65 has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-anchor-position-1] "determine position fallback styles" algorithm doesn't consider not using an option == In the "[Applying Position Fallback](https://drafts.csswg.org/css-anchor-position-1/#fallback-apply)" section, the "[determines position fallback styles](https://drafts.csswg.org/css-anchor-position-1/#determine-position-fallback-styles)" algorithm is used to figure out which position fallback option should be used next, when the box overflows in the current style: > To determine position fallback styles for an element abspos: > 1) Let current styles be the current used styles of abspos (which might be the result of earlier fallback). > 2) [For each](https://infra.spec.whatwg.org/#list-iterate) option in the [position options list](https://drafts.csswg.org/css-anchor-position-1/#position-options-list): > > 1 ) If option is currently abspos’s [last successful position option](https://drafts.csswg.org/css-anchor-position-1/#last-successful-position-option), [continue](https://infra.spec.whatwg.org/#iteration-continue). > > ... > 3) Assert: The previous step finished without finding a [position option](https://drafts.csswg.org/css-anchor-position-1/#position-option) that avoids overflow. > 4) Return current styles. It appears that the algorithm forgets to consider the case when no option is used? For example, consider a box with three position options: * Initially, the box doesn't overflow with the original style, so no position option is applied * Then, something happened (style changes or scrolling) that makes the box overflow, so it tried the position option and option 2 works. * Later on, some other thing happened that makes the box overflow. If following the algorithm above, it'd only consider option 1/2/3 and not the original style, even though the original style could've worked. From my experimentation, the following order seems to pass most (maybe all?) WPT tests: * Try the last successful position option first * Then try the original style without option * Then try the options in the position option list except the last successful position option. Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12890 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 1 October 2025 21:19:52 UTC