Skip to content

Commit 19b3629

Browse files
committed
chore(slideshow): keep swipe only on touch device
1 parent 4eba0ca commit 19b3629

File tree

8 files changed

+26
-11
lines changed

8 files changed

+26
-11
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Keep slideshow swipe only on touch device.
13+
14+
### Fixed
15+
16+
- Updated lodash from 4.17.19 to 4.17.21 to fix potential security risks.
17+
1018
## [1.0.15][] - 2021-05-03
1119

1220
### Added

packages/lumx-angularjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@lumx/core": "^1.0.15",
1010
"@lumx/icons": "^1.0.15",
1111
"focus-visible": "^5.0.2",
12-
"lodash": "4.17.19",
12+
"lodash": "4.17.21",
1313
"popper.js": "^1.16.0"
1414
},
1515
"description": "The official LumApps Design System (LumX) for AngularJS applications",

packages/lumx-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"dependencies": {
99
"classnames": "^2.2.6",
1010
"focus-visible": "^5.0.2",
11-
"lodash": "4.17.19",
11+
"lodash": "4.17.21",
1212
"sass-mq": "^5.0.0"
1313
},
1414
"description": "LumX core",

packages/lumx-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"yarn": "^1.19.1"
8484
},
8585
"peerDependencies": {
86-
"lodash": "4.17.19",
86+
"lodash": "4.17.21",
8787
"moment": "^2.24.0",
8888
"moment-range": "^4.0.2",
8989
"react": "^16.13.0",

packages/lumx-react/src/components/slideshow/useKeyOrSwipeNavigate.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { useEffect } from 'react';
22
import { detectSwipe } from '@lumx/core/js/utils';
33

4+
const isTouchDevice = () => 'ontouchstart' in window;
5+
46
/**
57
* Listen keyboard and swipe to navigate left and right.
68
*/
@@ -28,10 +30,10 @@ export function useKeyOrSwipeNavigate(
2830
};
2931

3032
element.addEventListener('keydown', onNavigate);
31-
const removeSwipeListeners = detectSwipe(element, onNavigate);
33+
const removeSwipeListeners = isTouchDevice() ? detectSwipe(element, onNavigate) : undefined;
3234
return () => {
3335
element.removeEventListener('keydown', onNavigate);
34-
removeSwipeListeners();
36+
removeSwipeListeners?.();
3537
};
3638
}, [onPrevious, onNext, element]);
3739
}

packages/site-demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"gatsby-source-filesystem": "^2.3.36",
4343
"gatsby-transformer-remark": "^2.8.46",
4444
"intersection-observer": "^0.7.0",
45-
"lodash": "4.17.19",
45+
"lodash": "4.17.21",
4646
"moment": "^2.24.0",
4747
"moment-range": "^4.0.2",
4848
"prism-react-renderer": "^0.1.5",

packages/yo-generators/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"dependencies": {
33
"chalk": "^2.4.2",
4-
"lodash": "4.17.19",
4+
"lodash": "4.17.21",
55
"yeoman-generator": "^4.1.0",
66
"yosay": "^2.0.2"
77
},

yarn.lock

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17846,16 +17846,21 @@ lodash.without@^4.4.0:
1784617846
resolved "https://registry.yarnpkg.com/lodash.without/-/lodash.without-4.4.0.tgz#3cd4574a00b67bae373a94b748772640507b7aac"
1784717847
integrity sha1-PNRXSgC2e643OpS3SHcmQFB7eqw=
1784817848

17849-
[email protected].19, lodash@^4.17.19:
17850-
version "4.17.19"
17851-
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
17852-
integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
17849+
17850+
version "4.17.21"
17851+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
17852+
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
1785317853

1785417854
lodash@^4.0.0, lodash@^4.0.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@~4.17.10:
1785517855
version "4.17.15"
1785617856
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
1785717857
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
1785817858

17859+
lodash@^4.17.19:
17860+
version "4.17.19"
17861+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
17862+
integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
17863+
1785917864
lodash@^4.17.20:
1786017865
version "4.17.20"
1786117866
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"

0 commit comments

Comments
 (0)