-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Feature Policy: focus-without-user-activation
#4585
base: main
Are you sure you want to change the base?
Conversation
f611320
to
e74637e
Compare
e74637e
to
8e312f2
Compare
focus-without-use-activation
focus-without-user-activation
focus-without-user-activation
focus-without-user-activation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change makes modifications to the focus processing model such that for a new
focus target that the policy is disabled (i.e., in its node document or its own document if
the target is a browsing context):
- Focus steps runs as normal but the focusable area is not changed.
This does not appear to be what is done in this patch. Instead, attempts at focusing are entirely aborted; no focusing steps are run.
@@ -53257,6 +53260,11 @@ form.method === input; // => true</code></pre> | |||
<li><p>If <var>target</var>'s <span>active sandboxing flag set</span> has the | |||
<span>sandboxed automatic features browsing context flag</span>, then return.</p></li> | |||
|
|||
<li><p>If this algorithm is not <span>triggered by user activation</span> and the | |||
policy-controlled feature "<code | |||
data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" is disabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the correct verbiage here is
<var>target</var> is not <span>allowed to use</span> the "<code
data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature
Cf. https://html.spec.whatwg.org/#playing-the-media-resource:allowed-to-use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out. Done.
<li><p>If this algorithm is not <span>triggered by user activation</span> and the | ||
policy-controlled feature "<code | ||
data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" is disabled | ||
in <var>current</var>'s <span>active document</span>, return.</p></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional nit: we're slowly moving toward using "then" for new if statements, so "then return". (Like the previous bullet.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Agreed and sorry for misrepresentation. The initial attempt was to modify update focus steps but since the algorithm is invoked from different parts of the spec, and that we only care about the API (now mentioned in the description), I believe the current spec change is more relevant. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, this looks good to me spec-text wise. What remains before we can merge this is multi-implementer interest, and web platform tests.
If the default is not blocking for third-party contexts, this seems like a sandboxing feature, in which case it'll be affected by the planned changes to Feature Policy, right? |
@ehsan-karamad it appears you force-pushed over my nit fixes, e.g. adding the word "feature" after feature names :(. |
My fixes got lost so now there are still nits to fix
Also, @ehsan-karamad, you work for Google, which is in the field of web technologies, so it's not appropriate to sign the Participant Agreement as an individual. Instead you need to make your membership in the Google organization public. |
Uh very sorry! I still need to find my way around github. |
Thanks. I didn't know it is private by default actually. I made it public. I wouldn't mind un-signing the agreement as an individual if that is a thing. |
Yes, for now, we are thinking about making this blocking by default in sandboxed subframes. But that said,
Yes. If there is no default enforcement to third party, sandbox flag might be the best fit and it will be definitely affected by how Feature Policy is changed. |
No worries! Could you push an additional commit which ensures that all instances say I've deleted your individual agreement submission; all is good there. |
Done. I pushed a change (not force this time) :).
Thanks! |
Marked "do not merge yet" as we need to figure out if this is permission-like (disabled in third party contexts unless this is set, enabled otherwise) or sandbox-like (can be disabled anywhere). cc @clelland |
Given that I don't know yet how web-compatible that change would be, but that's where I would like to see this end up. |
Just to make it explicit, is the idea to keep this PR open until there's multi-vendor support, or also until the change is proven web compatible by shipping it? @annevk, on the multi-vendor support front, who at Mozilla can speak to this? Aside: the |
Oops, I spoke to soon in my aside. The proposal says
That doesn't match the behavior of the |
I think this matches @clelland 's suggestion above and would place this policy along with the other permission-like policies. |
What's the state of this policy? Is there any plan to merge this or has the discussion moved somewhere else? |
I'd love to be able to ship this; there's a bit more discussion on w3c/webappsec-permissions-policy#273. Maybe 2024 is its year! |
This comment was marked as spam.
This comment was marked as spam.
Cherry-picked from whatwg#4585
I don't have editor access to this PR. So I've created #10672 to continue the work to ship this. |
focus-without-user-activation
is a new feature policy that can be used to blockprogrammatic programmatic focus changes that are not triggered through user activation
(explainer: w3c/webappsec-permissions-policy#304).
The motivation behind the change is to provide better security for websites that embed
content from third parties
(issue: w3c/webappsec-permissions-policy#273).
This change makes modifications to the following focus API
autofocus
element.focus(options)
window.focus()
💥 Error: Wattsi server error 💥
PR Preview failed to build. (Last tried on Jan 15, 2021, 7:59 AM UTC).
More
PR Preview relies on a number of web services to run. There seems to be an issue with the following one:
🚨 Wattsi Server - Wattsi Server is the web service used to build the WHATWG HTML spec.
🔗 Related URL
If you don't have enough information above to solve the error by yourself (or to understand to which web service the error is related to, if any), please file an issue.