Only allow turning off no-scroll if it is currently turned on
danoc opened this issue · comments
Daniel O’Connor commented
Hello!
It's fairly easy to misuse no-scroll
and call .off
before it has been turned on. When misused, this causes the page to scroll to the top since scrollTop
will be undefined:
Lines 37 to 46 in fcf54b6
Would it make sense to return
immediately on L38 when isOn
is false? Alternatively, don't run window.scroll
if scrollTop
is undefined
? (Happy to submit a PR.)
Thanks, @davidtheclark! Your modal libraries are 💯.
David Clark commented
Would it make sense to returning immediately on L38 when isOn is false?
This sounds good to me 👍I'll cut a quick release with a fix.
David Clark commented
Published in 2.1.1.