Don't focus on the current story until the animation ends #39837
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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