Open Bug 1139745 Opened 9 years ago Updated 2 years ago

element.scrollIntoView() confused by scroll-behavior:smooth;

Categories

(Core :: Layout, defect)

39 Branch
defect

Tracking

()

People

(Reporter: mail, Unassigned)

References

()

Details

(Keywords: testcase)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:36.0) Gecko/20100101 Firefox/36.0
Build ID: 20150222232811

Steps to reproduce:

1. create scrollable container with content that itself need to be scrolled to
2. Add scroll-behavior:smooth; to scroll container and body
3. call .scrollIntoView() on a child of the scroll container


Actual results:

content did not get scrolled to the correct position. target scroll position seems to vary depending on initial scroll offset of the scroll container.


Expected results:

target scroll offset should be the same for all permutations of scroll-behavior on nested scroll containers
Component: Untriaged → Layout: Form Controls
Keywords: testcase
Product: Firefox → Core
kip, do you want to take a look?
Component: Layout: Form Controls → Layout
Nightly 43.0a1, ID 20150901030226
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Mac OS X → Unspecified
Hardware: x86 → Unspecified
Hi all, I've writing a polyfill for smooth scorll behavior and got it working good on all modern browsers and even IE9. Of course if the polyfill detets the feature is present in the browser it skips doing anything, and I've detect that Firefox has a problem when calling scrollIntoView to an element that has a scrollable parent. It scrolls ok inside the parent but the viewport scrolls to the initial position of the element. I don't know if this is the same issue.

Also, I would like to collaborate (like trying to fix this bug for example) on the Firefox engine, are there any documents on how to checkout the code and start doing something? Thank you.
To see how scrollIntoView is not working go to https://iamdustan.github.io/smoothscroll and click on SCROLL INTO VIEW button, the window scrolls to the original position of the elemnt instead of the final one.
For nested scrollers, it looks like the animation is scheduled on the parent scroller. See http://output.jsbin.com/tenaye/quiet.

I should precise: the bug in Tab Center Redux is that when opening a tab in the background from a pinned tab so that the view should scroll up, then it scrolls to the item just below.

This behavior is still buggy so for Tab Center Reborn I use smooth-scroll-into-view-if-needed as a workaround. Would like this to be fixed some day though.

I’m not sure if it’s linked to bug 1584035, but I can’t reproduce anymore with the use case of the reporter.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: