Browse Source

Prevent clicks on video from initiating selections

closed-social-glitch-2
Thibaut Girka 6 years ago
committed by ThibG
parent
commit
925c185ef9
2 changed files with 11 additions and 2 deletions
  1. +6
    -0
      app/javascript/flavours/glitch/components/media_gallery.js
  2. +5
    -2
      app/javascript/flavours/glitch/features/video/index.js

+ 6
- 0
app/javascript/flavours/glitch/components/media_gallery.js View File

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

+ 5
- 2
app/javascript/flavours/glitch/features/video/index.js View File

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

Loading…
Cancel
Save