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

Investigate how to handle autofocus tests for newly inserted elements #1720

Open
whimboo opened this issue Feb 23, 2023 · 0 comments
Open

Investigate how to handle autofocus tests for newly inserted elements #1720

whimboo opened this issue Feb 23, 2023 · 0 comments

Comments

@whimboo
Copy link
Contributor

whimboo commented Feb 23, 2023

With whatwg/html#3488 a change landed in the HTML spec quiet some time ago which moved out the autofocus step into a separate task. It means that for newly inserted elements (eg. attachChild or due to a navigation) the autofocus is not rendered immediately but after the next request animation frame task.

With bug 1444491 this has been finally implemented in Firefox. With that landing we have seen new test failures (bug 1816955) for autofocus wdspec tests. We landed a temporary fix so that the test keeps working but also is still compliant to the current WebDriver classic specification. This basically runs the following Execute Async Script command before the Get Active Element command:

    session.execute_async_script(
        """
        const resolve = arguments[0];
        window.requestAnimationFrame(function() {
            window.requestAnimationFrame(resolve);
        });
        """
    )

To not require consumers to have to run this step on the client side we should probably update the Get Active Element command to request an animation frame first before actually trying to get the active element in step 3.

CC @jgraham, @foolip, @sadym-chromium what do you think?

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

No branches or pull requests

1 participant