Prevent clicks on video from initiating selections

This commit is contained in:
Thibaut Girka 2018-09-17 14:19:35 +02:00 committed by ThibG
parent 5c9a2f5d77
commit 925c185ef9
2 changed files with 11 additions and 2 deletions

View file

@ -78,6 +78,11 @@ class Item extends React.PureComponent {
e.stopPropagation();
}
handleMouseDown = (e) => {
e.preventDefault();
e.stopPropagation();
}
render () {
const { attachment, index, size, standalone, letterbox, displayWidth } = this.props;
@ -181,6 +186,7 @@ class Item extends React.PureComponent {
onClick={this.handleClick}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
onMouseDown={this.handleMouseDown}
autoPlay={autoPlay}
loop
muted

View file

@ -135,7 +135,10 @@ export default class Video extends React.PureComponent {
this.seek = c;
}
handleClickRoot = e => e.stopPropagation();
handleMouseDownRoot = e => {
e.preventDefault();
e.stopPropagation();
}
handlePlay = () => {
this.setState({ paused: false });
@ -319,7 +322,7 @@ export default class Video extends React.PureComponent {
ref={this.setPlayerRef}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
onClick={this.handleClickRoot}
onMouseDown={this.handleMouseDownRoot}
tabIndex={0}
>
<video