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

t.scroll is not a function

joshkel opened this issue · comments

After upgrading from scroll-into-view-if-needed 3.0.4 to 3.0.5, one of our Jest tests has started failing with the following error:

t.scroll is not a function

See https://codesandbox.io/s/scroll-into-view-3-0-5-zsbh6k?file=/src/index.test.js for a test case.

This issue was introduced by 6472ede. jsdom doesn't implement Element.scroll (see jsdom/jsdom#1422 and jsdom/jsdom#2626), so scroll-into-view-if-needed now throws errors if used in a jsdom environment, such as Jest uses.