Skip to content

[autofocus] Remove cross-origin check step for autofocus candidates - #11277

Merged
annevk merged 1 commit into
whatwg:mainfrom
ffiori:focus-without-user-activation-autofocus
May 5, 2025
Merged

annevk merged 1 commit into
whatwg:mainfrom
ffiori:focus-without-user-activation-autofocus

Conversation

@ffiori

@ffiori ffiori commented Apr 30, 2025 •

Copy link
Copy Markdown
Contributor

This PR addresses issue #11276. Step 6 in the algorithm for filtering autofocus candidates is not needed anymore after the addition of 'allow focus steps' in step 5 that checks if the element belongs to an element that allows the feature policy focus-without-user-activation, i.e. if an element is in a frame that allows the policy with *, then it should allow autofocus even if it's from a different origin.


/interaction.html ( diff )

@ffiori

ffiori commented Apr 30, 2025

Copy link
Copy Markdown
Contributor Author

cc @dandclark

@annevk

annevk commented May 2, 2025

Copy link
Copy Markdown
Member

Thank you!

This looks good to me, but we should add some test coverage for the combination of this permission policy and autofocus.

Also, I suspect you work for Microsoft? Please join the relevant GitHub organization to satisfy the IPR bot.

@ffiori

ffiori commented May 2, 2025

Copy link
Copy Markdown
Contributor Author

Hi @annevk, thanks for your review! There are already a couple WPT tests about the interaction of autofocus with the permissions policy here:

https://github.com/web-platform-tests/wpt/blob/master/permissions-policy/experimental-features/focus-without-user-activation-disabled.html
https://github.com/web-platform-tests/wpt/blob/master/permissions-policy/experimental-features/focus-without-user-activation-enabled.sub.html

Do you think this is enough coverage?

(btw thanks for mentioning the organization issue, I'm in the process of adding it)

@whatwg whatwg deleted a comment May 4, 2025
@annevk

annevk commented May 5, 2025

Copy link
Copy Markdown
Member

That appears sufficient, yes. In that case I think we should just consider this a bug fix on top of the original PR. You will need to address the Participation CI check though.

@ffiori

ffiori commented May 5, 2025

Copy link
Copy Markdown
Contributor Author

Thanks @annevk, I just managed to solve the Participation issue. Now it seems like all checks pass.

@annevk
annevk merged commit 88c7d93 into whatwg:main May 5, 2025
@annevk

annevk commented May 5, 2025

Copy link
Copy Markdown
Member

Thanks!

@ffiori
ffiori deleted the focus-without-user-activation-autofocus branch September 3, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

[autofocus] Elements from cross-origins shouldn't be omitted if they pass the allow focus steps

2 participants