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

Make scrollIntoView work for Safari and SVGElement #153

Open
arambert opened this issue Apr 10, 2020 · 4 comments
Open

Make scrollIntoView work for Safari and SVGElement #153

arambert opened this issue Apr 10, 2020 · 4 comments

Comments

@arambert
Copy link

arambert commented Apr 10, 2020

The polyfill for scrollIntoView doesn't work if you want to use it on an SVGElement (g, circle polygon, etc.) on Safari.
On Safari SVGElement does not inherit from HtmlElement || Element.
To make it work,
after:

import smoothscroll from 'smoothscroll-polyfill' smoothscroll.polyfill()
add:

window.SVGElement.prototype.scrollIntoView = (window.HTMLElement || window.Element).prototype.scrollIntoView

@arambert
Copy link
Author

If you don't use {behavior: 'smooth'} in your arguments it won't work either.

@arambert
Copy link
Author

I'd recommend using https://github.com/magic-akari/seamless-scroll-polyfill 👍 instead of this plugin.

@ieozt38
Copy link

ieozt38 commented Aug 16, 2020

I'd recommend using https://github.com/magic-akari/seamless-scroll-polyfill 👍 instead of this plugin.

Thank you fixed my issue! 👍

@acontreras89
Copy link

It is possible that this could be fixed by changing this line for

var Element = w.Element;

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