Lightbox: Ensure that click of video pauses it

This commit is contained in:
Scott Nonnenberg 2019-09-19 14:47:35 -07:00
parent 23b720a982
commit 43ac8ce37e
2 changed files with 2 additions and 5 deletions

View file

@ -71,6 +71,7 @@ const styles = {
maxWidth: '100%', maxWidth: '100%',
maxHeight: '100%', maxHeight: '100%',
objectFit: 'contain', objectFit: 'contain',
outline: 'none',
} as React.CSSProperties, } as React.CSSProperties,
caption: { caption: {
position: 'absolute', position: 'absolute',
@ -171,13 +172,10 @@ const Icon = ({
export class Lightbox extends React.Component<Props> { export class Lightbox extends React.Component<Props> {
private readonly containerRef: React.RefObject<HTMLDivElement>; private readonly containerRef: React.RefObject<HTMLDivElement>;
private readonly videoRef: React.RefObject<HTMLVideoElement>; private readonly videoRef: React.RefObject<HTMLVideoElement>;
private readonly playVideoBound: () => void;
constructor(props: Props) { constructor(props: Props) {
super(props); super(props);
this.playVideoBound = this.playVideo.bind(this);
this.videoRef = React.createRef(); this.videoRef = React.createRef();
this.containerRef = React.createRef(); this.containerRef = React.createRef();
} }
@ -292,7 +290,6 @@ export class Lightbox extends React.Component<Props> {
<video <video
role="button" role="button"
ref={this.videoRef} ref={this.videoRef}
onClick={this.playVideoBound}
controls={true} controls={true}
style={styles.object} style={styles.object}
key={objectURL} key={objectURL}

View file

@ -7493,7 +7493,7 @@
"rule": "React-createRef", "rule": "React-createRef",
"path": "ts/components/Lightbox.tsx", "path": "ts/components/Lightbox.tsx",
"line": " this.videoRef = React.createRef();", "line": " this.videoRef = React.createRef();",
"lineNumber": 181, "lineNumber": 179,
"reasonCategory": "usageTrusted", "reasonCategory": "usageTrusted",
"updated": "2019-03-09T00:08:44.242Z", "updated": "2019-03-09T00:08:44.242Z",
"reasonDetail": "Used to auto-start playback on videos" "reasonDetail": "Used to auto-start playback on videos"