Skip to content

Commit 77a1998

Browse files
committed
v16.0.1
Added detection for shift + click
1 parent 08c6d35 commit 77a1998

File tree

7 files changed

+21
-13
lines changed

7 files changed

+21
-13
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,14 @@ Scroll duration now varies based on distance traveled. If you want to maintain t
345345

346346
## Known Issues
347347

348+
### Reduce Motion Settings
349+
350+
This isn't really an "issue" so-much as a question I get a lot.
351+
352+
Smooth Scroll respects [the `Reduce Motion` setting](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion) available in certain operating systems. In browsers that surface that setting, Smooth Scroll will not run and will revert to the default "jump to location" anchor link behavior.
353+
354+
I've decided to respect user preferences of developer desires here. This is *not* a configurable setting.
355+
348356
### `<body>` styling
349357

350358
If the `<body>` element has been assigned a height of `100%` or `overflow: hidden`, Smooth Scroll is unable to properly calculate page distances and will not scroll to the right location. The `<body>` element can have a fixed, non-percentage based height (ex. `500px`), or a height of `auto`, and an `overflow` of `visible`.

dist/smooth-scroll.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* smooth-scroll v16.0.0
2+
* smooth-scroll v16.0.1
33
* Animate scrolling to anchor links
44
* (c) 2019 Chris Ferdinandi
55
* MIT License
@@ -503,8 +503,8 @@
503503
// Don't run if the user prefers reduced motion
504504
if (reduceMotion(settings)) return;
505505

506-
// Don't run if right-click or command/control + click
507-
if (event.button !== 0 || event.metaKey || event.ctrlKey) return;
506+
// Don't run if right-click or command/control + click or shift + click
507+
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey) return;
508508

509509
// Check if event.target has closest() method
510510
// By @totegi - https://github.com/cferdinandi/smooth-scroll/pull/401/

dist/smooth-scroll.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/smooth-scroll.polyfills.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* smooth-scroll v16.0.0
2+
* smooth-scroll v16.0.1
33
* Animate scrolling to anchor links
44
* (c) 2019 Chris Ferdinandi
55
* MIT License
@@ -573,8 +573,8 @@ if (window.Element && !Element.prototype.closest) {
573573
// Don't run if the user prefers reduced motion
574574
if (reduceMotion(settings)) return;
575575

576-
// Don't run if right-click or command/control + click
577-
if (event.button !== 0 || event.metaKey || event.ctrlKey) return;
576+
// Don't run if right-click or command/control + click or shift + click
577+
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey) return;
578578

579579
// Check if event.target has closest() method
580580
// By @totegi - https://github.com/cferdinandi/smooth-scroll/pull/401/

0 commit comments

Comments
 (0)