v151 · permissions-policy · iframes · focus
Permissions Policy: focus-without-user-activation
Chrome 151 introduces a focus-without-user-activation Permissions Policy feature that lets embedders control whether embedded iframes can programmatically move focus without a prior user activation. When denied, calls to element.focus(), autofocus, dialog.showModal(), and popover focusing are blocked unless the user has interacted first.
at a glance
| Shipped in | Chrome 151 (Enabled by default) |
|---|---|
| Status | Enabled by default |
| Standards position (Firefox) | No signal |
| Standards position (Safari) | Support |
| ChromeStatus | 5179186249465856 — Permissions Policy: focus-without-user-activation |
why it exists
Embedded third-party iframes can steal focus from the embedding page by calling element.focus() or triggering an autofocus attribute without any user interaction. This is disruptive in embed-heavy layouts (dashboards, ad slots, widget galleries) where unexpected focus shifts break keyboard navigation and screen-reader context.
The focus-without-user-activation policy gives the embedding page control: when the policy is denied for a frame, all programmatic focus calls inside that frame are silently ignored unless a user gesture has occurred first. User-initiated focus (clicking, tabbing) is never affected — the policy only blocks programmatic focus without a prior activation.
Focus delegation is still supported: a parent frame that currently has focus can transfer it programmatically to a child iframe even if the child has the policy denied.
Source: chromestatus feature summaryshape of the API
| Policy feature | Default allowlist | Set via |
|---|---|---|
focus-without-user-activation | * (allowed everywhere by default) | Permissions-Policy HTTP header or <iframe allow> attribute |
Focus calls blocked when denied: element.focus(), autofocus attribute, window.focus(), dialog.showModal(), popover focusing.
Never blocked: user-initiated focus (click, tab key, touch).
Source: chromestatus feature summaryexample
<!-- Deny programmatic focus for an embedded iframe -->
<iframe
src="https://widget.example.com"
allow="focus-without-user-activation 'none'"
></iframe>
<!-- Via HTTP response header (applies to all child frames) -->
<!-- Permissions-Policy: focus-without-user-activation=() -->
<!-- Focus delegation still works: parent transfers focus to iframe -->
<iframe id="child" src="https://widget.example.com"
allow="focus-without-user-activation 'none'"></iframe>
<script>
// This works — parent delegates focus to child
document.getElementById('child').focus();
// Inside the iframe, element.focus() is then allowed within the child's subtree
</script>
Source: chromestatus feature summary
browser support
| Browser | Support | Notes |
|---|---|---|
| Chrome 151+ | Enabled by default | All platforms |
| Firefox | No signal | — |
| Safari | Support | — |