diff options
author | Akira Ouchi <akkiesoft@marokun.net> | 2023-01-09 11:52:37 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-09 03:52:37 +0100 |
commit | 2195f21524270e50c00a6292f77dfe39342ff482 (patch) | |
tree | 4418dfa24cb2e1a4fde491c034d89369a24ef9e9 /app/javascript | |
parent | 105e1f0ca6dd722fad26106c9b40b19c67f42ec1 (diff) |
Add variable autoFocus to video (#15281) (#22778)
* add variable autoFocus to video * set autoFocus in video_modal.js
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/mastodon/features/ui/components/video_modal.js | 1 | ||||
-rw-r--r-- | 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 f3ee89dfd..abaccbe98 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 4f90e955f..1c35ca9d1 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 { <div className='video-player__buttons-bar'> <div className='video-player__buttons left'> - <button type='button' title={intl.formatMessage(paused ? messages.play : messages.pause)} aria-label={intl.formatMessage(paused ? messages.play : messages.pause)} className='player-button' onClick={this.togglePlay} autoFocus={detailed}><Icon id={paused ? 'play' : 'pause'} fixedWidth /></button> + <button type='button' title={intl.formatMessage(paused ? messages.play : messages.pause)} aria-label={intl.formatMessage(paused ? messages.play : messages.pause)} className='player-button' onClick={this.togglePlay} autoFocus={autoFocus}><Icon id={paused ? 'play' : 'pause'} fixedWidth /></button> <button type='button' title={intl.formatMessage(muted ? messages.unmute : messages.mute)} aria-label={intl.formatMessage(muted ? messages.unmute : messages.mute)} className='player-button' onClick={this.toggleMute}><Icon id={muted ? 'volume-off' : 'volume-up'} fixedWidth /></button> <div className={classNames('video-player__volume', { active: this.state.hovered })} onMouseDown={this.handleVolumeMouseDown} ref={this.setVolumeRef}> |