Capybara.disable_animation also disables view transitions #2790
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.
Problem
Animations provided by the View Transition API are not disabled when
Capybara.disable_animations
is set. This can lead to Capybara not being able to interact with certain elements before a view transition has completed.For a personal project, this manifested as an
input
which could not be clicked until the transition completed, even though the page content could be ready.Potential Solution
I wanted to see what it would look like to do the simplest thing possible with
Capybara::Server::AnimationDisabler
to cover view transitions. While this works, it does betray the "selector" feature ofdisable_animations
, as this behaves the same way even if a selector is supplied as if it were set totrue
.As I understand it, the View Transition API's CSS pseudo-selectors do not allow animation characteristics (such as
animation-duration
) to be changed for individual elements in the normal DOM tree. Instead, they are controlled via named view transitions and pseudo-selectors that exist in their own tree. Transition names also cannot be applied to more than one element, so using a broad selector to assign dummy transition names would likely cause bugs.I'm curious what others think about this. I didn't want to add a lot of complexity to this API without getting some early feedback. But a couple of possibilities I'd considered:
AnimationDisabler
middleware to support itAnimationDisabler
I may also be mistaken about not being able to use existing selector-driven approach. If this could be made to work, then that would simplify this problem quite a bit.