From f57a14494184280505d611ae0c4634d43e26a6d7 Mon Sep 17 00:00:00 2001 From: Akira Ouchi Date: Mon, 9 Jan 2023 11:52:37 +0900 Subject: [PATCH] Add variable autoFocus to video (#15281) (#22778) * add variable autoFocus to video * set autoFocus in video_modal.js --- .../mastodon/features/ui/components/video_modal.js | 1 + app/javascript/mastodon/features/video/index.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/features/ui/components/video_modal.js b/app/javascript/mastodon/features/ui/components/video_modal.js index f3ee89dfd9..abaccbe985 100644 --- a/app/javascript/mastodon/features/ui/components/video_modal.js +++ b/app/javascript/mastodon/features/ui/components/video_modal.js @@ -46,6 +46,7 @@ export default class VideoModal extends ImmutablePureComponent { autoPlay={options.autoPlay} volume={options.defaultVolume} onCloseVideo={onClose} + autoFocus detailed alt={media.get('description')} /> diff --git a/app/javascript/mastodon/features/video/index.js b/app/javascript/mastodon/features/video/index.js index 4f90e955fe..1c35ca9d1f 100644 --- a/app/javascript/mastodon/features/video/index.js +++ b/app/javascript/mastodon/features/video/index.js @@ -122,6 +122,7 @@ class Video extends React.PureComponent { volume: PropTypes.number, muted: PropTypes.bool, componentIndex: PropTypes.number, + autoFocus: PropTypes.bool, }; static defaultProps = { @@ -523,7 +524,7 @@ class Video extends React.PureComponent { } render () { - const { preview, src, inline, onOpenVideo, onCloseVideo, intl, alt, detailed, sensitive, editable, blurhash } = this.props; + const { preview, src, inline, onOpenVideo, onCloseVideo, intl, alt, detailed, sensitive, editable, blurhash, autoFocus } = this.props; const { containerWidth, currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, muted, revealed } = this.state; const progress = Math.min((currentTime / duration) * 100, 100); const playerStyle = {}; @@ -617,7 +618,7 @@ class Video extends React.PureComponent {
- +