scroll-into-view-if-needed icon indicating copy to clipboard operation
scroll-into-view-if-needed copied to clipboard

t.scroll is not a function

Open joshkel opened this issue 2 years ago • 1 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.

joshkel avatar Feb 21 '23 21:02 joshkel

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

joshkel avatar Mar 29 '23 19:03 joshkel