-
Notifications
You must be signed in to change notification settings - Fork 667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cssom-view] scrollIntoView and sticky elements #3104
Comments
#1459 Related? Or possible dup? |
Tangentially related. #1459 is about scrolling sticky elements. I'm talking about scrolling a regular element into view which has sticky ancestors which may, when the element is scrolled into view, reduce the scrolling area viewport. It's a difficult one. Because if there's a It's so weird that behaviour has to be strictly defined, otherwise different browser vendors will do all kinds of different things. |
An ancestor of the element being scrolled into view is sticky? Or does the resolution in #2929 relate? Different browsers are already applying heuristics to fixed and sticky positioned elements as well as are now s'pose to take the |
Could you post a test-case which differs across browsers? (We should define the behavior regardless, but that makes it easier to evaluate which definition we want :)). Thanks! |
@ExtAnimal Here is a crude (starting point) attempt at a test case for this issue. Though consistent across browsers, it shows how sticky elements obfuscate an element using both I understand that the use of |
@emilio The example above shows the issue. Scrolling When calculating a target rectangle into which an element may be scrolled, the rectangles of occluding sticky elements must be subtracted from that rectangle. And there may be multiple target rectangles if some sticky elements are for example |
"Occluded" is fairly hard to define as a concept, fwiw. Do things like box shadows count as "occluding"? See also all the ink-overflow-related discussions. In general, Not opposed to add some best-effort handling of sticky to the scrollIntoView algorithm, but my ask was to see what different browsers were doing. At least on my machine, the test-case above behaves consistently across browsers, so there's no "magic" going on. A concrete proposal would be great. I could try to come up with something and tests, but honestly I'm a bit swamped with other work right now and this doesn't seem like something super-prioritary... |
All that has to be taken into account is the A simplified best-effort could even only consider This is the most common usage. To "stick" headers or footers to the edges of a scrolling viewport. If we handled that simplified scenario, it's just a matter of clipping off those stickies when calculating the rectangle to move the scrolled element into. |
Currently the specification at https://drafts.csswg.org/cssom-view/#dom-element-scrollintoview makes no mention of sticky elements.
Chrome appears to behave as expected when there are sticky ancestors of the element being scrolled into view.
But the behaviour needs to be defined.
The text was updated successfully, but these errors were encountered: