Open LifeIsStrange opened 2 years ago
/cc @flackr - thoughts on the above?
This seems reasonable, though for future proofing I wonder if we should provide a scrollIntoViewOptions
rather than duplicating those options here. If we didn't already have preventScroll: true
I would have proposed something like using a single parameter scroll
or scrollOptions
to both determine whether we scroll and set the options for that scroll, but we could just add scrollOptions or scrollBehavior.
As an example, we would like to add a way for the scrolling APIs to be contained to some scroller rather than scrolling all scrollers to the root: https://github.com/w3c/csswg-drafts/issues/10451 . It makes sense you'd want to support that here too.
When we focus an element in the DOM, the default behaviour is to autoscroll to the element. The scrolling can be disabled with the option preventScroll: true;
The manual way to scroll would be to call https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView ScrollIntoView has a behaviour option which allow to define smooth scrolling instead of the default (instant teleport "scrolling").
Since smooth scrolling is often the desired behaviour and since we very often want scrolling on focus, it would be nice to provide a smooth scrolling behaviour option for focus directly instead of having to workaround the issue (and I suspect the easiests workaround hinder scrolling performance/framerate).