scroll-into-view / scroll-into-view-if-needed

Element.scrollIntoView ponyfills for things like "if-needed" and "smooth"

Home Page:https://scroll-into-view.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug - full-height elements can't scroll into view

matthew-dean opened this issue Β· comments

I ran into a situation in my code where I wanted to change something so that a full-height element (same height as scroll container) would scroll into view. To my surprise, nothing happened. I thought it must be my code, so I made a Codepen, with the same behavior (nothing happens): https://codepen.io/matthewdean/pen/KxaJga

To verify that it wasn't something wrong with scrolling setup, I made a 99% height tile version, which works: https://codepen.io/matthewdean/pen/qMRgVL

Then I thought, "Well maybe this is just a bug where elements larger than the scrollable area don't scroll into view," at which point I discovered something totally bonkers. A Codepen with tiles that are 101% also work. https://codepen.io/matthewdean/pen/QVdYQp

So this bug appears to be that only tiles the same exact height as the scrollable area cannot scroll into view

Hey! Thanks for the detailed report!

I don't know when I'll have time to work on this but I'll ping you here when I do. πŸ™‚

Hey again! I will be working on a fix for this tomorrow πŸ˜„

πŸŽ‰ This issue has been resolved in version 2.2.19 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

I've implemented the fix in compute-scroll-into-view and released new versions of scroll-into-view-if-needed and smooth-scroll-into-view-if-needed with the fix.

Looks like the reproduction codepen works now https://codepen.io/matthewdean/pen/KxaJga πŸ™‚