Cannot read property 'clientHeight' of undefined
fcurts opened this issue Β· comments
2.2.8 is the last version that works for me (tried both Chrome and Safari). 2.2.9 and all later versions fail with:
scroll-into-view.min.js:1 Uncaught TypeError: Cannot read property 'clientHeight' of undefined
at n (scroll-into-view.min.js:1)
at r (scroll-into-view.min.js:1)
at scroll-into-view.min.js:1
Here is the failing invocation (elem
is neither undefined
nor null
):
scrollIntoView(elem, {
behavior: 'instant',
scrollMode: 'if-needed',
block: 'nearest',
inline: 'nearest',
});
Figured it out. Was trying to scroll to an element before it had been added to the DOM. Apparently this works or is a no-op in 2.2.8 but fails in later versions.
Interesting! Iβm going to re-open this issue and investigate how native browsers handle this, and if itβs included in the CSSOM View spec what should happen.
IMO we should either no-op or provide a better error message than "clientHeight" on undefined
π€
Hi @stipsan is there any update on this? We are using this plugin but because of this bug we may have to find another solution if this doesn't get fixed soon so hoping your close to releasing a fix? Thanks!
π This issue has been resolved in version 2.2.17 π
The release is available on:
Your semantic-release bot π¦π
@bluecaret please let me know if v2.2.17
didn't solve it π
Awesome! Glad I said something ;) I'll take a look tomorrow. Thanks for the fast reply and work!
@stipsan It worked great! And FYI we are using the smooth-scroll addon so it works with that as well. Thanks again!
Great to hear! π