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

Don't focus on the current story until the animation ends #39837

Merged
merged 2 commits into from
Feb 21, 2024

Conversation

ychsieh
Copy link
Contributor

@ychsieh ychsieh commented Feb 16, 2024

Context:
In Firefox, when player.show() is called, the transition animation of iframes(that host stories) cause the final position to be wrong. More specifically, it only happens when you show the 2nd story(not any other stories), where after the animation the story with index 1 is at the position 0, and all stories with index n is at the position n-1. Basically, the entire array of stories shift left by one.

This bug only happens in Firefox. I agree with Corey that focus() and transition animation running at the same time somehow cause the bug. This PR fixes it by first waiting for the transition animation to end, and then call focus() to focus on the current story's iframe element.

#38634

@ychsieh ychsieh requested a review from erwinmombay February 16, 2024 20:49
@ychsieh ychsieh merged commit 051cfaf into ampproject:main Feb 21, 2024
42 of 43 checks passed
eszponder pushed a commit to krzysztofequativ/amphtml that referenced this pull request Apr 22, 2024
…#39837)

* Don't focus on the current story until the animation ends

* Fix lint errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants