Open Bug 1257600 Opened 5 years ago Updated 3 years ago

Should focus-induced scrolling respect the scroll-behavior property?


(Core :: Layout, defect)

Not set



Tracking Status
firefox48 --- affected


(Reporter: mstange, Unassigned)




(1 file)

Attached file testcase
If you change focus, we scroll the focused element into view. But this scroll does not seem to respect the specified scroll behavior. Should it?

One case in which this creates problems is if web pages want to redirect the focus scroll to a different location with a smooth scroll. What happens now is that the browser sync-scrolls to the location that it thinks the focused element is displayed at, and then JS gets a chance to handle the focus event and can start a smooth scroll to the actual location that it wants the browser to scroll to. But this smooth scroll will start at the position that the browser sync-scrolled to, not at the scroll position from before the focus change. This can look very bad.
For an example, see and try to tab through the elements.
I asked for spec input at .
CSSOM Spec says about scroll-behavior, :

> The scroll-behavior property specifies the scrolling behavior for a scrolling box, when scrolling happens due to navigation or CSSOM scrolling APIs. Any other scrolls, e.g. those that are performed by the user, are not affected by this property.

I think the "navigation" here includes both the sequential focus navigation triggered by pressing "tab" key and the navigation to a fragment.
In chrome, scroll-behavior works both types of the navigation.
But in firefox, it only works for the navigation to a fragment. You can test the case from here:
You need to log in before you can comment on or make changes to this bug.