Closed
Bug 1238741
Opened 10 years ago
Closed 10 years ago
scrollIntoView scrolls document unnecessarily
Categories
(Core :: Layout, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: bugzzilla, Unassigned)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:43.0) Gecko/20100101 Firefox/43.0
Build ID: 20160105164030
Steps to reproduce:
Load attached test case. There is a DIV in the document with overflow-y:scroll and a list of sub-DIVs, causing the outer DIV to overflow. Click button to scroll one of the lower sub-DIVs into view.
Actual results:
Outer DIV scrolls to selected sub-DIV, and entire document scrolls to place the sub-DIV at the top of the viewport.
Expected results:
Only outer DIV should scroll to the selected sub-DIV. Document should not scroll if scrolling the outer DIV already brings the sub-DIV into view.
Comment 1•10 years ago
|
||
Here's the spec for scrollIntoView:
https://drafts.csswg.org/cssom-view/#scroll-an-element-into-view
I think it's saying that what Firefox is doing is correct. In particular, calling scrollIntoView without arguments means that the top edge of the target element should be aligned with the top edge of all ancestor scrollable boxes.
"run these steps for each ancestor element or viewport that establishes a scrolling box"
Comment 2•10 years ago
|
||
Closing since FF is following spec as :mstange reports above.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Component: Untriaged → Layout
Resolution: --- → INVALID
environment:
Mac OS X 10.11.6 Firefox 49.0.2 release, 51.0a2 dev
When scrollIntoView has option {behavior: 'smooth'} , scroll with other node.
MDN:
https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
please see attachment new test case.
Flags: needinfo?(mstange)
You need to log in
before you can comment on or make changes to this bug.
Description
•