scroll-into-view-if-needed
scroll-into-view-if-needed copied to clipboard
t.scroll is not a function
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 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.