-
Notifications
You must be signed in to change notification settings - Fork 746
Open
Description
In the "Applying Position Fallback" section, the "determines 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:
- Let current styles be the current used styles of abspos (which might be the result of earlier fallback).
- For each option in the position options list:
1 ) If option is currently abspos’s last successful position option, continue.
...
- Assert: The previous step finished without finding a position option that avoids overflow.
- 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.