-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
Provide a general summary of the issue here
Found while working on the carousel/rotator RFC - Our scrollIntoView
shim correctly scrolls the visible layout rect into view, but does not consider scroll margins. This is not in parity with the native behavior of element.scrollIntoView()
.
🤔 Expected Behavior?
Element should be scrolled to its visible layout rect offset by its scroll margin.
😯 Current Behavior
Element is only visibly scrolled into view, even though scroll margin explicitly marks a wish to scroll to an offset.
💁 Possible Solution
getComputedStyle
for the element as well when scrolling in to view. Then offset the rect to account for margin in px.
🔦 Context
No response
🖥️ Steps to Reproduce
- Visit the example in https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
- Scroll the "Go to bottom" button (scroll-margin of 60px) out of view
- Run this script in the console:
document.getElementById('go-to-bottom').scrollIntoView({block: 'nearest', container: 'nearest'})
Version
latest
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
OSX
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
Metadata
Metadata
Assignees
Labels
No labels