Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variable autoFocus to video #22778

Merged
merged 1 commit into from
Jan 9, 2023
Merged

Add variable autoFocus to video #22778

merged 1 commit into from
Jan 9, 2023

Conversation

Akkiesoft
Copy link
Contributor

Fixes #15281.

@ClearlyClaire ClearlyClaire self-requested a review January 2, 2023 13:06
@ClearlyClaire
Copy link
Contributor

Note that the autoFocus has been added in #12498 so that the focus is given to the video controls when it's expanded in the interface, so removing it altogether introduces a regression, and I do not believe this is the best way to deal with the situation. I am not sure why this triggers in embeds, I'm going to check that out.

Copy link
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue occurs because embeds use detailed: true in app/views/statuses/_detailed_status.html.haml. It would make sense to me to decouple the autofocus from the detailed behavior. It would also make sense to use detailed in app/javascript/mastodon/features/status/components/detailed_status.js but that is another issue.

@@ -617,7 +617,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}><Icon id={paused ? 'play' : 'pause'} fixedWidth /></button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of removing it altogether, I would add an autoFocus prop that app/javascript/mastodon/features/ui/components/video_modal.js would make use of in addition to detailed.

@Akkiesoft Akkiesoft changed the title Remove needless autoFocus from video Add variable autoFocus to video Jan 6, 2023
app/helpers/statuses_helper.rb Outdated Show resolved Hide resolved
app/javascript/mastodon/features/video/index.js Outdated Show resolved Hide resolved
* add variable autoFocus to video
* set autoFocus in video_modal.js
Copy link
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you for your contribution!

@Gargron Gargron merged commit 2195f21 into mastodon:main Jan 9, 2023
@Akkiesoft Akkiesoft deleted the 15281 branch January 9, 2023 02:56
nametoolong pushed a commit to nametoolong/nuage that referenced this pull request Jan 12, 2023
* add variable autoFocus to video
* set autoFocus in video_modal.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Embedding posts and scrolling on their own
3 participants