1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-25 11:13:52 +02:00

fix(slider): suppress console warnings in Chrome for Android when scrubbing (#5219)

Instead of calling preventDefault() on touchstart in Chrome, set touch-action: none style on progress control to prevent unintended scrolling.

Fixes #4650.
This commit is contained in:
Darius Oleskevicius 2018-06-06 03:32:38 +10:00 committed by Gary Katsevman
parent a29156ca7b
commit 59869b9d49
2 changed files with 12 additions and 1 deletions

View File

@ -6,6 +6,7 @@
@include flex(auto);
@include display-flex(center);
min-width: 4em;
touch-action: none;
}
.video-js .vjs-progress-control.disabled {

View File

@ -4,6 +4,7 @@
import Component from '../component.js';
import * as Dom from '../utils/dom.js';
import {assign} from '../utils/obj';
import {IS_CHROME} from '../utils/browser.js';
/**
* The base functionality for a slider. Can be vertical or horizontal.
@ -145,7 +146,16 @@ class Slider extends Component {
handleMouseDown(event) {
const doc = this.bar.el_.ownerDocument;
event.preventDefault();
if (event.type === 'mousedown') {
event.preventDefault();
}
// Do not call preventDefault() on touchstart in Chrome
// to avoid console warnings. Use a 'touch-action: none' style
// instead to prevent unintented scrolling.
// https://developers.google.com/web/updates/2017/01/scrolling-intervention
if (event.type === 'touchstart' && !IS_CHROME) {
event.preventDefault();
}
Dom.blockTextSelection();
this.addClass('vjs-sliding');