Skip to content

Make scrollIntoView work for Safari and SVGElement #153

@arambert

Description

@arambert

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions