-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to force centering #165
Comments
The centering feature of the non-standard To import scrollIntoView from 'scroll-into-view-if-needed'
scrollIntoView(element, {block: 'center', inline: 'center'}) In a standard There's also an ongoing discussion on how to implement the So far the consensus seems to be import scrollIntoView from 'scroll-into-view-if-needed'
scrollIntoView(element, {scrollMode: 'if-needed', block: 'center', inline: 'center'}) I will likely start ponyfilling these new APIs and spec'ed behavior instead of |
v2 supports the example above 😄 |
@stipsan I just started using the library today for an list of questions with expandable answers. I want the question and answer to scroll onto the screen if it isn't fully visible. I'm using:
I was quite surprised to find that the element is always centered using this method - even if it is already fully visible on screen. Is this really how it's supposed to work or am I doing something stupid? The unsupported 'scrollIntoViewIfNeeded' in Chrome does what I would expect - and only scrolls to the center if the item is partially off the screen. This behavior is exactly how you'd expect a list of questions to work. Instead I have had to switch to Happy to open an issue but I can't imagine I'm the first person to notice this. |
Hey can you share a reproduction of this? It should indeed only center when needed 🤔 |
Description of
options.centerIfNeeded
says:Description of
options.forceCenter
would be:The text was updated successfully, but these errors were encountered: