Skip to content

Commit

Permalink
prevent accidental swipe gestures when scrubbing video/audio timelines
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Apr 12, 2021
1 parent 290c251 commit be110fa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/reveal.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions js/controllers/touch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { isAndroid } from '../utils/device.js'
import { matches } from '../utils/util.js'

const SWIPE_THRESHOLD = 40;

Expand Down Expand Up @@ -82,6 +83,9 @@ export default class Touch {
*/
isSwipePrevented( target ) {

// Prevent accidental swipes when scrubbing timelines
if( matches( target, 'video, audio' ) ) return true;

while( target && typeof target.hasAttribute === 'function' ) {
if( target.hasAttribute( 'data-prevent-swipe' ) ) return true;
target = target.parentNode;
Expand Down

0 comments on commit be110fa

Please sign in to comment.