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:
parent
a29156ca7b
commit
59869b9d49
@ -6,6 +6,7 @@
|
||||
@include flex(auto);
|
||||
@include display-flex(center);
|
||||
min-width: 4em;
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.video-js .vjs-progress-control.disabled {
|
||||
|
@ -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');
|
||||
|
Loading…
x
Reference in New Issue
Block a user