Skip to content
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

scrollIntoView with arguments is not working #176

Open
joyblanks opened this issue Sep 1, 2021 · 3 comments
Open

scrollIntoView with arguments is not working #176

joyblanks opened this issue Sep 1, 2021 · 3 comments

Comments

@joyblanks
Copy link

I have an element to center align in page respect to its parent

document.querySelector('#someid').scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' });

It works fine without this polyfill (but without behavior smooth of course), But when the polyfill is active the arguments are discarded

@isGabe
Copy link

isGabe commented Sep 15, 2021

Same issue here, trying to get it working in React + iOS Safari, but it's leading me to believe that the polyfill just isn't loading at all, since Safari does support scrollIntoView() without options;

I've looked through #139 and tried all different combinations of importing, putting in a useEffect hook moving it to the top level index.tsx component, etc, and it just won't work if I add options.

@isGabe
Copy link

isGabe commented Sep 15, 2021

Well, I figured out why it wasn't working in my case. For reasons that aren't relevant here, I had this in my css:

html,
body {
  height: 100%;
  overflow: auto;
  width: 100%;
}

Removing overflow: auto made the scrolling work. Now I have to do some work to be able to remove that style without breaking something else. Ah, web development 🙂

@kunal-compro
Copy link

Well, I figured out why it wasn't working in my case. For reasons that aren't relevant here, I had this in my css:

html,
body {
  height: 100%;
  overflow: auto;
  width: 100%;
}

Removing overflow: auto made the scrolling work. Now I have to do some work to be able to remove that style without breaking something else. Ah, web development 🙂

Removing overflow: auto from parent worked for me too. Not sure why it worked🤨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants