Closed jonaskuske closed 4 years ago
Just encountered this too - is there a short-term workaround before it is officially fixed/released?
@iamkeir Yep, change line 264
from this:
if (evt.metaKey || evt.ctrlKey || evt.shiftKey || evt.button !== 0) return;
to this
if (evt.metaKey || evt.ctrlKey || evt.shiftKey || evt.button !== 0 || evt.defaultPrevented) return;
and you should be good :)
And I'll write a test for it and release the new version this week. ππ»
@iamkeir Fixed and published :)
Youβre the best!! Thank you for such a swift fix. Happy Easter.
I'm being a bit special... where can I download the new dist version?
Yep! If you don't get the latest version, specify it explicitly with https://unpkg.com/smoothscroll-anchor-polyfill@1.3.2 β otherwise unpkg might still give you an older version due to caching. This way you also won't run into trouble if a v2 with breaking changes is published at some point.
(I should also update the docs to recommend specifying the version as part of the URL)
Thanks dude - I also wondered why the dist folder was empty? Anyway all good, thank you very much :) Do you have a tip jar?
I also wondered why the dist folder was empty
The repository only contains the source code. When publishing the package to the npm registry, that source code is (more or less) automatically compiled into the dist files you can then use via unpkg and similar CDNs and registries. But they don't need to stay in the repo, the repo just includes the code and instructions necessary to predictably regenerate them.
And thanks, but nope, not looking for tips :)
In browsers with native support, clicking the anchor from the example above does not scroll the page β
.preventDefault()
stops the defaulthref="#"
scroll behavior.smoothscroll-anchor-polyfill
currently ignores this, its clickHandler starts scrolling even ifevent.defaultPrevented === true
. Needs fix.