W3C home > Mailing lists > Public > public-css-archive@w3.org > September 2020

Re: [csswg-drafts] [cssom-view-1] Provide onAnimationEnd callback in scrollIntoView options (#3744)

From: Ferdy via GitHub <sysbot+gh@w3.org>
Date: Wed, 02 Sep 2020 11:58:50 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-685683932-1599047929-sysbot+gh@w3.org>
The particular scenario mentioned by @CyberAP can be solved as follow:

`html { scroll-behavior: smooth; }`


Without the preventScroll parameter, you are subject to browser quirks as below:

Scrolls to the correct position (meaning, element.scrollIntoView) yet abandons smooth scrolling, even though the browser supports it. Not great, but at least the scroll position is correct.

Same as Firefox yet would not scroll smoothly in any case, as it's not supported. Not great, but at least the scroll position is correct.

Chrome is the big offender here. It seems to cancel the scrollIntoView action altogether, instead does the smooth scroll from element.focus(), CSS based, and scroll position logic is based on that. In practice, this often means a wrong scroll position.

**Other scenarios**
Whilst preventScroll solves this particular scenario, I still very much agree we need a callback. If you need to do anything else after scrolling completes (say, run an animation), there's no robust way to do that right now. 

GitHub Notification of comment by fchristant
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3744#issuecomment-685683932 using your GitHub account

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 2 September 2020 11:58:54 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:15 UTC