From 11494026e9425e6146a6df1238242956e1854adb Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Wed, 6 Dec 2023 18:26:44 +1100 Subject: [PATCH 01/21] Add keyboard locking option --- fullscreen.bs | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/fullscreen.bs b/fullscreen.bs index 16ad739..065f6b3 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -61,6 +61,12 @@ unset.

All <{iframe}> elements have an associated iframe fullscreen flag. Unless stated otherwise it is unset. +

All documents have an associated keyboard lock flag. This flag indicates +whether the keyboard lock is active for the document. When the flag is set, the document captures +and handles key inputs as specified by a passed {{FullscreenKeyboardLock}} enum value. When the +flag is not set, keyboard inputs are processed in the default manner by the user agent and the +operating system. +

All documents have an associated fullscreen element. The fullscreen element is the topmost element in the document's top layer whose fullscreen flag is set, if any, and null otherwise. @@ -188,7 +194,14 @@ enum FullscreenNavigationUI { "hide" }; +enum FullscreenKeyboardLock { + "application", + "none", + "system" +} + dictionary FullscreenOptions { + FullscreenKeyboardLock keyboardLock = "none"; FullscreenNavigationUI navigationUI = "auto"; }; @@ -228,6 +241,18 @@ partial interface mixin DocumentOrShadowRoot { free to honor user preference over the application's. The default value "{{FullscreenNavigationUI/auto}}" indicates no application preference. +

+ When supplied, options's {{FullscreenOptions/keyboardLock}} member indicates whether + the supplied keyboard lock mode should apply. + + If set to "{{FullscreenKeyboardLock/application}}", [=application-level keyboard lock=] should + be applied. + + If set to "{{FullscreenKeyboardLock/system}}", [=system-level keyboard lock=] should be applied. + + User agents are always free to honor user preference over the application's. The default value + "{{FullscreenKeyboardLock/none}}" indicates no keyboard lock is applied. +
document . {{Document/fullscreenEnabled}}

Returns true if document has the ability to display elements fullscreen and fullscreen is supported, or false otherwise. @@ -350,6 +375,12 @@ are: steps. +

  • + If, {{FullscreenOptions}}'s {{FullscreenOptions/keyboardLock}}'s value is not supported, + reject promise with a {{NotSupportedError}} exception and terminate these + steps. +
  • +
  • Let fullscreenElements be an ordered set initially consisting of this. @@ -389,6 +420,16 @@ are: doc's list of pending fullscreen events. +

  • + Depending on the value of {{FullscreenOptions}}'s {{FullscreenOptions/keyboardLock}}: +
    +
    "{{FullscreenKeyboardLock/application}}"
    +

    Apply an [=application-level keyboard lock=]. +

    "{{FullscreenKeyboardLock/system}}"
    +

    Apply a [=system-level keyboard lock=]. +

    +
  • +

    The order in which elements are fullscreened is not observable, because run the fullscreen steps is invoked in tree order. @@ -506,6 +547,8 @@ could be an open <{dialog}> element.

  • Return promise, and run the remaining steps in parallel. +

  • Run [=the release the keyboard lock steps=] with doc. +

  • Run the [=fully unlock the screen orientation steps=] with doc.

  • If resize is true, resize doc's viewport to its "normal" dimensions. @@ -595,6 +638,11 @@ algorithm as part of the close request steps. This takes precedence over

    The user agent may end any fullscreen session without a close request or call to {{Document/exitFullscreen()}} whenever the user agent deems it necessary. +

    Users should be clearly notified when [=keyboard locking=] is active, possibly through browser +UI indicators. + +

    There should be a simple and intuitive method for users to override keyboard locking, reverting +control back to the system or user agent.

    Rendering

    @@ -652,6 +700,30 @@ iframe:fullscreen { +

    keyboard lock

    + +

    keyboard Locking enhances the functionality of web applications running in fullscreen by allowing +them to intercept certain key inputs that would typically be handled by either the system or the +user agent. This is useful in scenarios such as gaming or remote desktop applications, where keys +like ESC or function keys are integral to the application's functionality. + +

    A keyboard lock enables web applications to capture and handle key inputs directly, +bypassing the default behavior typically executed by the user agent (in the case of +"{{FullscreenKeyboardLock/application}}") or operating system (in the case of +"{{FullscreenKeyboardLock/system}}"). When the [=keyboard lock flag=] is set for a [=document=], key +events that would normally trigger user agent or system-level actions are instead redirected to the +web application in fullscreen. + +

    +
    Application-level keyboard lock
    +

    Captures all keys that the user agent would ordinarily receive, except those reserved for + critical system functions or security shortcuts (e.g., Ctrl+Alt+Del). +

    System-level keyboard lock
    +

    capture a wider range of keys, including those used for system-level navigation and + shortcuts (e.g., Alt+Tab), subject to user consent and user agent implementation. +

    + +

    Permissions Policy Integration

    @@ -689,6 +761,12 @@ delivered with the document through which it is nested.

    This prevents e.g. content from third parties to go fullscreen without explicit permission. +

    When applying a [=keyboard lock=], only a limited set of keys, primarily those not involving +system control or privacy risks (like Alt+Tab, Ctrl+Alt+Del), can be locked via the API. + +

    When applying a [=keyboard lock=], user agents should implement safeguards to prevent abuse of +this feature, such as allowing users to override the lock. +

    From 8b58287310ba99f56711f70f45635f0d419ca544 Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Wed, 6 Dec 2023 18:37:47 +1100 Subject: [PATCH 02/21] Bikeshed fixes --- fullscreen.bs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index 065f6b3..8d1bc56 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -198,7 +198,7 @@ enum FullscreenKeyboardLock { "application", "none", "system" -} +}; dictionary FullscreenOptions { FullscreenKeyboardLock keyboardLock = "none"; @@ -547,7 +547,7 @@ could be an open <{dialog}> element.
  • Return promise, and run the remaining steps in parallel. -

  • Run [=the release the keyboard lock steps=] with doc. +

  • [=Run the release the keyboard lock steps=] with doc.

  • Run the [=fully unlock the screen orientation steps=] with doc. @@ -700,7 +700,7 @@ iframe:fullscreen { -

    keyboard lock

    +

    keyboard locking

    keyboard Locking enhances the functionality of web applications running in fullscreen by allowing them to intercept certain key inputs that would typically be handled by either the system or the @@ -723,6 +723,16 @@ web application in fullscreen. shortcuts (e.g., Alt+Tab), subject to user consent and user agent implementation. +

    +

    To run the release the keyboard lock steps for a document + document, run these steps: +

      +
    1. If the [=keyboard lock flag=] for the document is not set, abort these steps. +

    2. Deactivate the keyboard lock and restore the handling of keyboard inputs to the default + behavior of the user agent and the operating system.

    3. Set the [=keyboard lock flag=] for + the document to false. +

    +

    Permissions Policy Integration

    From dc8e9716c50269a67795a5987a85ae3e8e15d946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Wed, 6 Dec 2023 18:41:02 +1100 Subject: [PATCH 03/21] Update fullscreen.bs --- fullscreen.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fullscreen.bs b/fullscreen.bs index 8d1bc56..55f6d08 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -376,7 +376,7 @@ are:
  • - If, {{FullscreenOptions}}'s {{FullscreenOptions/keyboardLock}}'s value is not supported, + If {{FullscreenOptions}}'s {{FullscreenOptions/keyboardLock}}'s value is not supported, reject promise with a {{NotSupportedError}} exception and terminate these steps.
  • From 71be4b1bed3c5c53681bec2d405a3b0f145a8b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Wed, 6 Dec 2023 18:42:28 +1100 Subject: [PATCH 04/21] Update fullscreen.bs --- fullscreen.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fullscreen.bs b/fullscreen.bs index 55f6d08..0ba9a00 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -719,7 +719,7 @@ web application in fullscreen.

    Captures all keys that the user agent would ordinarily receive, except those reserved for critical system functions or security shortcuts (e.g., Ctrl+Alt+Del).

    System-level keyboard lock
    -

    capture a wider range of keys, including those used for system-level navigation and +

    Capture a wider range of keys, including those used for system-level navigation and shortcuts (e.g., Alt+Tab), subject to user consent and user agent implementation. From 41d4f1d0a6095ec3e3e0cb2e692ad9a08bb78da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Wed, 6 Dec 2023 18:57:42 +1100 Subject: [PATCH 05/21] Update fullscreen.bs --- fullscreen.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fullscreen.bs b/fullscreen.bs index 0ba9a00..283685d 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -65,7 +65,7 @@ stated otherwise it is unset. whether the keyboard lock is active for the document. When the flag is set, the document captures and handles key inputs as specified by a passed {{FullscreenKeyboardLock}} enum value. When the flag is not set, keyboard inputs are processed in the default manner by the user agent and the -operating system. +operating system. Unless stated otherwise it is unset.

    All documents have an associated fullscreen element. The fullscreen element is the topmost element in the document's From f7a41e066e69d24ff7cf4d970e8bff3ffaeb037b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Fri, 8 Dec 2023 16:34:28 +1100 Subject: [PATCH 06/21] Apply suggestions from code review Co-authored-by: Martin Thomson --- fullscreen.bs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index 283685d..16ad4f7 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -700,9 +700,9 @@ iframe:fullscreen { -

    keyboard locking

    +

    Keyboard Locking

    -

    keyboard Locking enhances the functionality of web applications running in fullscreen by allowing +

    Keyboard locking enhances the functionality of web applications running in fullscreen by allowing them to intercept certain key inputs that would typically be handled by either the system or the user agent. This is useful in scenarios such as gaming or remote desktop applications, where keys like ESC or function keys are integral to the application's functionality. @@ -716,20 +716,26 @@ web application in fullscreen.

    Application-level keyboard lock
    -

    Captures all keys that the user agent would ordinarily receive, except those reserved for - critical system functions or security shortcuts (e.g., Ctrl+Alt+Del). +

    Captures all keys that the user agent would ordinarily receive, such as those that open or + close windows. This excludes those reserved for system-level interactions, such + as key presses that open system menus or switch applications.

    System-level keyboard lock

    Capture a wider range of keys, including those used for system-level navigation and shortcuts (e.g., Alt+Tab), subject to user consent and user agent implementation.

    +

    User agents should reserve an additional input for the purposes of exiting fullscreen. +There are also some system-level key sequences or combinations that cannot be +intercepted for security reasons, such as Ctrl+Alt+Del on Windows. +

    To run the release the keyboard lock steps for a document document, run these steps:

    1. If the [=keyboard lock flag=] for the document is not set, abort these steps.

    2. Deactivate the keyboard lock and restore the handling of keyboard inputs to the default - behavior of the user agent and the operating system.

    3. Set the [=keyboard lock flag=] for + behavior of the user agent and the operating system. +

    4. Set the [=keyboard lock flag=] for the document to false.

    From c334cd4fa2cd5593e71122e2867035f9e959df80 Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Wed, 15 Apr 2026 15:24:32 +0200 Subject: [PATCH 07/21] Rename 'application' to 'browser' --- fullscreen.bs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index 16ad4f7..be39e6d 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -195,7 +195,7 @@ enum FullscreenNavigationUI { }; enum FullscreenKeyboardLock { - "application", + "browser", "none", "system" }; @@ -245,7 +245,7 @@ partial interface mixin DocumentOrShadowRoot { When supplied, options's {{FullscreenOptions/keyboardLock}} member indicates whether the supplied keyboard lock mode should apply. - If set to "{{FullscreenKeyboardLock/application}}", [=application-level keyboard lock=] should + If set to "{{FullscreenKeyboardLock/browser}}", [=application-level keyboard lock=] should be applied. If set to "{{FullscreenKeyboardLock/system}}", [=system-level keyboard lock=] should be applied. @@ -423,7 +423,7 @@ are:
  • Depending on the value of {{FullscreenOptions}}'s {{FullscreenOptions/keyboardLock}}:
    -
    "{{FullscreenKeyboardLock/application}}"
    +
    "{{FullscreenKeyboardLock/browser}}"

    Apply an [=application-level keyboard lock=].

    "{{FullscreenKeyboardLock/system}}"

    Apply a [=system-level keyboard lock=]. @@ -709,7 +709,7 @@ like ESC or function keys are integral to the application's functionality.

    A keyboard lock enables web applications to capture and handle key inputs directly, bypassing the default behavior typically executed by the user agent (in the case of -"{{FullscreenKeyboardLock/application}}") or operating system (in the case of +"{{FullscreenKeyboardLock/browser}}") or operating system (in the case of "{{FullscreenKeyboardLock/system}}"). When the [=keyboard lock flag=] is set for a [=document=], key events that would normally trigger user agent or system-level actions are instead redirected to the web application in fullscreen. From 9bce1d5125afa021b84d2da8b887b83e3e567fb8 Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Wed, 15 Apr 2026 19:59:29 +0200 Subject: [PATCH 08/21] Avoid 'should' in non-normative text --- fullscreen.bs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index be39e6d..5036150 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -241,14 +241,12 @@ partial interface mixin DocumentOrShadowRoot { free to honor user preference over the application's. The default value "{{FullscreenNavigationUI/auto}}" indicates no application preference. -

    When supplied, options's {{FullscreenOptions/keyboardLock}} member indicates whether - the supplied keyboard lock mode should apply. + the supplied keyboard lock mode will apply. - If set to "{{FullscreenKeyboardLock/browser}}", [=application-level keyboard lock=] should - be applied. + If set to "{{FullscreenKeyboardLock/browser}}", [=application-level keyboard lock=] can be applied. - If set to "{{FullscreenKeyboardLock/system}}", [=system-level keyboard lock=] should be applied. + If set to "{{FullscreenKeyboardLock/system}}", [=system-level keyboard lock=] can be applied. User agents are always free to honor user preference over the application's. The default value "{{FullscreenKeyboardLock/none}}" indicates no keyboard lock is applied. From f3f66c4ebb14d849c3668d85a22b034026468ebd Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Thu, 16 Apr 2026 16:24:25 +0200 Subject: [PATCH 09/21] Add 'removing steps' to link-defaults --- fullscreen.bs | 1 + 1 file changed, 1 insertion(+) diff --git a/fullscreen.bs b/fullscreen.bs index 5036150..7ba00f6 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -16,6 +16,7 @@ spec:dom type:dfn; for:/; text:document type:dfn; for:/; text:element type:interface; text:Document + type:dfn; text:removing steps spec:infra type:dfn; for:set; text:for each type:dfn; text:string From 0447e6e25d2bb56700aa64241c3883440a476279 Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Thu, 16 Apr 2026 16:58:26 +0200 Subject: [PATCH 10/21] Remove the 'system' enum --- fullscreen.bs | 65 +++++++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 38 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index 7ba00f6..b5d37be 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -64,9 +64,9 @@ stated otherwise it is unset.

    All documents have an associated keyboard lock flag. This flag indicates whether the keyboard lock is active for the document. When the flag is set, the document captures -and handles key inputs as specified by a passed {{FullscreenKeyboardLock}} enum value. When the -flag is not set, keyboard inputs are processed in the default manner by the user agent and the -operating system. Unless stated otherwise it is unset. +and handles key inputs as specified by a passed {{FullscreenKeyboardLock}} enum value. When the flag +is not set, keyboard inputs are processed in the default manner by the user agent and the operating +system. Unless stated otherwise it is unset.

    All documents have an associated fullscreen element. The fullscreen element is the topmost element in the document's @@ -197,8 +197,7 @@ enum FullscreenNavigationUI { enum FullscreenKeyboardLock { "browser", - "none", - "system" + "none" }; dictionary FullscreenOptions { @@ -245,9 +244,7 @@ partial interface mixin DocumentOrShadowRoot { When supplied, options's {{FullscreenOptions/keyboardLock}} member indicates whether the supplied keyboard lock mode will apply. - If set to "{{FullscreenKeyboardLock/browser}}", [=application-level keyboard lock=] can be applied. - - If set to "{{FullscreenKeyboardLock/system}}", [=system-level keyboard lock=] can be applied. + If set to "{{FullscreenKeyboardLock/browser}}", [=keyboard lock=] can be applied. User agents are always free to honor user preference over the application's. The default value "{{FullscreenKeyboardLock/none}}" indicates no keyboard lock is applied. @@ -375,9 +372,8 @@ are:

  • - If {{FullscreenOptions}}'s {{FullscreenOptions/keyboardLock}}'s value is not supported, - reject promise with a {{NotSupportedError}} exception and terminate these - steps. + If {{FullscreenOptions}}'s {{FullscreenOptions/keyboardLock}}'s value is not supported, reject + promise with a {{NotSupportedError}} exception and terminate these steps.
  • Let fullscreenElements be an ordered set initially consisting of @@ -423,9 +419,7 @@ are: Depending on the value of {{FullscreenOptions}}'s {{FullscreenOptions/keyboardLock}}:

    "{{FullscreenKeyboardLock/browser}}"
    -

    Apply an [=application-level keyboard lock=]. -

    "{{FullscreenKeyboardLock/system}}"
    -

    Apply a [=system-level keyboard lock=]. +

    Set the [=keyboard lock flag=] for doc to true.

  • @@ -637,8 +631,8 @@ algorithm as part of the close request steps. This takes precedence over

    The user agent may end any fullscreen session without a close request or call to {{Document/exitFullscreen()}} whenever the user agent deems it necessary. -

    Users should be clearly notified when [=keyboard locking=] is active, possibly through browser -UI indicators. +

    Users should be clearly notified when [=keyboard locking=] is active, possibly through browser UI +indicators.

    There should be a simple and intuitive method for users to override keyboard locking, reverting control back to the system or user agent. @@ -706,36 +700,31 @@ them to intercept certain key inputs that would typically be handled by either t user agent. This is useful in scenarios such as gaming or remote desktop applications, where keys like ESC or function keys are integral to the application's functionality. -

    A keyboard lock enables web applications to capture and handle key inputs directly, -bypassing the default behavior typically executed by the user agent (in the case of -"{{FullscreenKeyboardLock/browser}}") or operating system (in the case of -"{{FullscreenKeyboardLock/system}}"). When the [=keyboard lock flag=] is set for a [=document=], key -events that would normally trigger user agent or system-level actions are instead redirected to the -web application in fullscreen. - -

    -
    Application-level keyboard lock
    -

    Captures all keys that the user agent would ordinarily receive, such as those that open or - close windows. This excludes those reserved for system-level interactions, such - as key presses that open system menus or switch applications. -

    System-level keyboard lock
    -

    Capture a wider range of keys, including those used for system-level navigation and - shortcuts (e.g., Alt+Tab), subject to user consent and user agent implementation. -

    +

    A [=document=] has keyboard lock active when the [=keyboard lock flag=] is true for a +[=document=], and inactive otherwise. + +

    A [=keyboard lock=] enables web applications to capture and handle key inputs directly, bypassing +the default behavior typically executed by the user agent or operating system. Key events that would +normally trigger user agent or system-level actions are instead redirected to the web application in +fullscreen. Such key events (for individual keys or keyboard shortcuts) may either have no action +while [=keyboard lock=] is active, or it could still have the same action but allow the web page to +call {{Event/preventDefault()}} to cancel the action. -

    User agents should reserve an additional input for the purposes of exiting fullscreen. -There are also some system-level key sequences or combinations that cannot be -intercepted for security reasons, such as Ctrl+Alt+Del on Windows. +

    User agents should reserve an additional input for the purposes of exiting fullscreen. There are +also some system-level key sequences or combinations that cannot be intercepted for security +reasons, such as Ctrl+Alt+Del on Windows.

    To run the release the keyboard lock steps for a document document, run these steps: +

      -
    1. If the [=keyboard lock flag=] for the document is not set, abort these steps. +

    2. If the [=keyboard lock flag=] for document is not set, then return. +

    3. Deactivate the keyboard lock and restore the handling of keyboard inputs to the default behavior of the user agent and the operating system. -

    4. Set the [=keyboard lock flag=] for - the document to false. + +

    5. Set the [=keyboard lock flag=] for document to false.

    From d7eb7a911499207dd5d988812d38a02f1102340b Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Fri, 17 Apr 2026 09:45:48 +0200 Subject: [PATCH 11/21] Fix validation error --- fullscreen.bs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index b5d37be..3c282f4 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -415,17 +415,17 @@ are: doc's list of pending fullscreen events. -
  • - Depending on the value of {{FullscreenOptions}}'s {{FullscreenOptions/keyboardLock}}: -
    -
    "{{FullscreenKeyboardLock/browser}}"
    -

    Set the [=keyboard lock flag=] for doc to true. -

    -
  • -

    The order in which elements are fullscreened is not observable, because run the fullscreen steps is invoked in tree order. +

  • +

    Depending on the value of {{FullscreenOptions}}'s {{FullscreenOptions/keyboardLock}}: + +

    +
    "{{FullscreenKeyboardLock/browser}}"
    +

    Set the [=keyboard lock flag=] for doc to true. +

    +
  • Resolve promise with undefined. From 11a7f57e16f6fcf09f65f15bdd2280087eed1373 Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Wed, 22 Apr 2026 15:37:25 +0200 Subject: [PATCH 12/21] Store 'keyboard lock flag' on element instead of document --- fullscreen.bs | 54 +++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index 3c282f4..1b56476 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -62,12 +62,6 @@ unset.

    All <{iframe}> elements have an associated iframe fullscreen flag. Unless stated otherwise it is unset. -

    All documents have an associated keyboard lock flag. This flag indicates -whether the keyboard lock is active for the document. When the flag is set, the document captures -and handles key inputs as specified by a passed {{FullscreenKeyboardLock}} enum value. When the flag -is not set, keyboard inputs are processed in the default manner by the user agent and the operating -system. Unless stated otherwise it is unset. -

    All documents have an associated fullscreen element. The fullscreen element is the topmost element in the document's top layer whose fullscreen flag is set, if any, and null otherwise. @@ -94,7 +88,7 @@ is an ordered set of (string, element) tuples. It is

    To unfullscreen an element, unset element's -fullscreen flag and iframe fullscreen flag (if any), and +fullscreen flag, iframe fullscreen flag (if any), and keyboard lock flag, and remove from the top layer immediately given element.

    To unfullscreen a document, @@ -184,7 +178,24 @@ steps:

    These steps integrate with the event loop defined in HTML. [[!HTML]] +


    + +

    All elements have an associated keyboard lock flag. Unless stated otherwise it is unset. + +

    A [=document=] has keyboard lock active when its [=fullscreen element=] is not null and the [=fullscreen element=]'s [=keyboard lock flag=] is true, and inactive otherwise. + +

    +

    To run the release the keyboard lock steps for a document + document, run these steps: + +

      +
    1. If document's fullscreen element is null, then return. +

    2. If the [=keyboard lock flag=] for document's fullscreen element is false, then return. + +

    3. Set the [=keyboard lock flag=] for document's fullscreen element to false. +

    +

    API

    @@ -371,10 +382,8 @@ are: steps. -
  • - If {{FullscreenOptions}}'s {{FullscreenOptions/keyboardLock}}'s value is not supported, reject +
  • If options["{{FullscreenOptions/keyboardLock}}"] is not supported, then reject promise with a {{NotSupportedError}} exception and terminate these steps. -

  • Let fullscreenElements be an ordered set initially consisting of this. @@ -419,11 +428,14 @@ are: is not observable, because run the fullscreen steps is invoked in tree order.

  • -

    Depending on the value of {{FullscreenOptions}}'s {{FullscreenOptions/keyboardLock}}: +

    Depending on the value of options["{{FullscreenOptions/keyboardLock}}"]:

    "{{FullscreenKeyboardLock/browser}}"
    -

    Set the [=keyboard lock flag=] for doc to true. +

    Set the [=keyboard lock flag=] for this to true. + +

    "{{FullscreenKeyboardLock/none}}"
    +

    Set the [=keyboard lock flag=] for this to false.

  • Resolve promise with undefined. @@ -700,9 +712,6 @@ them to intercept certain key inputs that would typically be handled by either t user agent. This is useful in scenarios such as gaming or remote desktop applications, where keys like ESC or function keys are integral to the application's functionality. -

    A [=document=] has keyboard lock active when the [=keyboard lock flag=] is true for a -[=document=], and inactive otherwise. -

    A [=keyboard lock=] enables web applications to capture and handle key inputs directly, bypassing the default behavior typically executed by the user agent or operating system. Key events that would normally trigger user agent or system-level actions are instead redirected to the web application in @@ -710,23 +719,12 @@ fullscreen. Such key events (for individual keys or keyboard shortcuts) may eith while [=keyboard lock=] is active, or it could still have the same action but allow the web page to call {{Event/preventDefault()}} to cancel the action. +

    Whenever a [=document=]'s [=keyboard lock=] is changed from active to inactive, user agents must deactivate the keyboard lock and restore the handling of keyboard inputs to the default behavior of the user agent and the operating system. +

    User agents should reserve an additional input for the purposes of exiting fullscreen. There are also some system-level key sequences or combinations that cannot be intercepted for security reasons, such as Ctrl+Alt+Del on Windows. -

    -

    To run the release the keyboard lock steps for a document - document, run these steps: - -

      -
    1. If the [=keyboard lock flag=] for document is not set, then return. - -

    2. Deactivate the keyboard lock and restore the handling of keyboard inputs to the default - behavior of the user agent and the operating system. - -

    3. Set the [=keyboard lock flag=] for document to false. -

    -

    Permissions Policy Integration

    From f4149b1c6a26917a0c472f64f149c52f17cc0e05 Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Wed, 22 Apr 2026 15:46:08 +0200 Subject: [PATCH 13/21] Set |error| to true if keyboard lock is not supported, so it gets the same treatment as other error conditions --- fullscreen.bs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index 1b56476..1ad3346 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -150,6 +150,9 @@ these steps:

    Fullscreen is supported if there is no previously-established user preference, security risk, or platform limitation. +

    Keyboard lock is supported if there is no previously-established user preference, +security risk, or platform limitation. +


    @@ -324,6 +327,8 @@ are: algorithm is triggered by a user generated orientation change. +
  • If options["{{FullscreenOptions/keyboardLock}}"] is "{{FullscreenKeyboardLock/browser}}" and keyboard lock is supported is false, then set error to true. +

  • If error is false, then consume user activation given pendingDoc's relevant global object. @@ -382,9 +387,6 @@ are: steps. -

  • If options["{{FullscreenOptions/keyboardLock}}"] is not supported, then reject - promise with a {{NotSupportedError}} exception and terminate these steps. -

  • Let fullscreenElements be an ordered set initially consisting of this. From c5510c5fe116cb6f5a290964998f74a9c37be44b Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Thu, 23 Apr 2026 12:00:18 +0200 Subject: [PATCH 14/21] Don't reject when keyboard lock is not supported/enabled --- fullscreen.bs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index 1ad3346..940b681 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -150,9 +150,6 @@ these steps:

    Fullscreen is supported if there is no previously-established user preference, security risk, or platform limitation. -

    Keyboard lock is supported if there is no previously-established user preference, -security risk, or platform limitation. -


    @@ -327,8 +324,6 @@ are: algorithm is triggered by a user generated orientation change. -
  • If options["{{FullscreenOptions/keyboardLock}}"] is "{{FullscreenKeyboardLock/browser}}" and keyboard lock is supported is false, then set error to true. -

  • If error is false, then consume user activation given pendingDoc's relevant global object. @@ -771,6 +766,8 @@ system control or privacy risks (like Alt+Tab, Ctrl+Alt+Del), can be locked via

    When applying a [=keyboard lock=], user agents should implement safeguards to prevent abuse of this feature, such as allowing users to override the lock. +

    User agents may provide a user preference to ignore [=keyboard lock=] (with any granularity, e.g. for a specific site, or globally). Similarly, some platforms might not have a keyboard, where user agents may ignore the [=keyboard lock=] state. However, this should not affect the web-observable behavior of the {{Element/requestFullscreen()}} method or be exposed in other ways, to avoid fingerprinting. +

    From e3aedaa5a90cd82fa7dbee9f030143e36638a8b1 Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Thu, 23 Apr 2026 12:00:43 +0200 Subject: [PATCH 15/21] specfmt --- fullscreen.bs | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index 940b681..0f712f2 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -87,9 +87,9 @@ is an ordered set of (string, element) tuples. It is
  • Add to the top layer given element. -

    To unfullscreen an element, unset element's -fullscreen flag, iframe fullscreen flag (if any), and keyboard lock flag, and -remove from the top layer immediately given element. +

    To unfullscreen an element, unset element's fullscreen +flag, iframe fullscreen flag (if any), and keyboard lock flag, and remove from +the top layer immediately given element.

    To unfullscreen a document, unfullscreen all elements, within document's @@ -180,9 +180,11 @@ steps:


    -

    All elements have an associated keyboard lock flag. Unless stated otherwise it is unset. +

    All elements have an associated keyboard lock flag. Unless stated otherwise it +is unset. -

    A [=document=] has keyboard lock active when its [=fullscreen element=] is not null and the [=fullscreen element=]'s [=keyboard lock flag=] is true, and inactive otherwise. +

    A [=document=] has keyboard lock active when its [=fullscreen element=] is not null +and the [=fullscreen element=]'s [=keyboard lock flag=] is true, and inactive otherwise.

    To run the release the keyboard lock steps for a document @@ -191,9 +193,11 @@ steps:

    1. If document's fullscreen element is null, then return. -

    2. If the [=keyboard lock flag=] for document's fullscreen element is false, then return. +

    3. If the [=keyboard lock flag=] for document's fullscreen element is + false, then return. -

    4. Set the [=keyboard lock flag=] for document's fullscreen element to false. +

    5. Set the [=keyboard lock flag=] for document's fullscreen element to + false.

    @@ -716,7 +720,9 @@ fullscreen. Such key events (for individual keys or keyboard shortcuts) may eith while [=keyboard lock=] is active, or it could still have the same action but allow the web page to call {{Event/preventDefault()}} to cancel the action. -

    Whenever a [=document=]'s [=keyboard lock=] is changed from active to inactive, user agents must deactivate the keyboard lock and restore the handling of keyboard inputs to the default behavior of the user agent and the operating system. +

    Whenever a [=document=]'s [=keyboard lock=] is changed from active to inactive, user agents must +deactivate the keyboard lock and restore the handling of keyboard inputs to the default behavior of +the user agent and the operating system.

    User agents should reserve an additional input for the purposes of exiting fullscreen. There are also some system-level key sequences or combinations that cannot be intercepted for security @@ -766,7 +772,11 @@ system control or privacy risks (like Alt+Tab, Ctrl+Alt+Del), can be locked via

    When applying a [=keyboard lock=], user agents should implement safeguards to prevent abuse of this feature, such as allowing users to override the lock. -

    User agents may provide a user preference to ignore [=keyboard lock=] (with any granularity, e.g. for a specific site, or globally). Similarly, some platforms might not have a keyboard, where user agents may ignore the [=keyboard lock=] state. However, this should not affect the web-observable behavior of the {{Element/requestFullscreen()}} method or be exposed in other ways, to avoid fingerprinting. +

    User agents may provide a user preference to ignore [=keyboard lock=] (with any granularity, e.g. +for a specific site, or globally). Similarly, some platforms might not have a keyboard, where user +agents may ignore the [=keyboard lock=] state. However, this should not affect the web-observable +behavior of the {{Element/requestFullscreen()}} method or be exposed in other ways, to avoid +fingerprinting. From 19f6ae6ce3dc7685516c0c6f76351a6f95573a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20J=C3=A4genstedt?= Date: Mon, 4 May 2026 15:25:19 +0200 Subject: [PATCH 16/21] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Philip Jägenstedt --- fullscreen.bs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index 0f712f2..36c8cda 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -184,20 +184,19 @@ steps: is unset.

    A [=document=] has keyboard lock active when its [=fullscreen element=] is not null -and the [=fullscreen element=]'s [=keyboard lock flag=] is true, and inactive otherwise. +and the [=fullscreen element=]'s [=keyboard lock flag=] is set, and inactive otherwise.

    -

    To run the release the keyboard lock steps for a document - document, run these steps: +

    To release the keyboard lock for a document document, run these + steps:

    1. If document's fullscreen element is null, then return. -

    2. If the [=keyboard lock flag=] for document's fullscreen element is - false, then return. +

    3. If document's fullscreen element's [=keyboard lock flag=] is unset, + then return. -

    4. Set the [=keyboard lock flag=] for document's fullscreen element to - false. +

    5. Unset document's fullscreen element's [=keyboard lock flag=].

    @@ -553,7 +552,7 @@ could be an open <{dialog}> element.
  • Return promise, and run the remaining steps in parallel. -

  • [=Run the release the keyboard lock steps=] with doc. +

  • [=Release the keyboard lock=] for doc.

  • Run the [=fully unlock the screen orientation steps=] with doc. From 876c6c0a62ffb0bf9394d81f9bdcc449210bec7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20J=C3=A4genstedt?= Date: Mon, 4 May 2026 15:28:41 +0200 Subject: [PATCH 17/21] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Philip Jägenstedt --- fullscreen.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index 36c8cda..11cc950 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -432,10 +432,10 @@ are:

    "{{FullscreenKeyboardLock/browser}}"
    -

    Set the [=keyboard lock flag=] for this to true. +

    Se this's [=keyboard lock flag=].

    "{{FullscreenKeyboardLock/none}}"
    -

    Set the [=keyboard lock flag=] for this to false. +

    Unset this's [=keyboard lock flag=].

  • Resolve promise with undefined. From 6a63f94738f288693dbcd11a1c8d319b7e064239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20J=C3=A4genstedt?= Date: Mon, 4 May 2026 15:30:22 +0200 Subject: [PATCH 18/21] fix my typo --- fullscreen.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fullscreen.bs b/fullscreen.bs index 11cc950..229b5c6 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -432,7 +432,7 @@ are:

    "{{FullscreenKeyboardLock/browser}}"
    -

    Se this's [=keyboard lock flag=]. +

    Set this's [=keyboard lock flag=].

    "{{FullscreenKeyboardLock/none}}"

    Unset this's [=keyboard lock flag=]. From f21a81cf9da3041c366ae9a85c45b9cf6b97faf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20J=C3=A4genstedt?= Date: Mon, 4 May 2026 15:49:09 +0200 Subject: [PATCH 19/21] Avoid [=this style=] for consistency --- fullscreen.bs | 54 +++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index 229b5c6..574221a 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -183,8 +183,8 @@ steps:

    All elements have an associated keyboard lock flag. Unless stated otherwise it is unset. -

    A [=document=] has keyboard lock active when its [=fullscreen element=] is not null -and the [=fullscreen element=]'s [=keyboard lock flag=] is set, and inactive otherwise. +

    A document has keyboard lock active when its fullscreen element is not +null and the fullscreen element's keyboard lock flag is set, and inactive otherwise.

    To release the keyboard lock for a document document, run these @@ -193,10 +193,10 @@ and the [=fullscreen element=]'s [=keyboard lock flag=] is set, and inactive oth

    1. If document's fullscreen element is null, then return. -

    2. If document's fullscreen element's [=keyboard lock flag=] is unset, +

    3. If document's fullscreen element's keyboard lock flag is unset, then return. -

    4. Unset document's fullscreen element's [=keyboard lock flag=]. +

    5. Unset document's fullscreen element's keyboard lock flag.

    @@ -258,7 +258,7 @@ partial interface mixin DocumentOrShadowRoot { When supplied, options's {{FullscreenOptions/keyboardLock}} member indicates whether the supplied keyboard lock mode will apply. - If set to "{{FullscreenKeyboardLock/browser}}", [=keyboard lock=] can be applied. + If set to "{{FullscreenKeyboardLock/browser}}", keyboard lock can be applied. User agents are always free to honor user preference over the application's. The default value "{{FullscreenKeyboardLock/none}}" indicates no keyboard lock is applied. @@ -432,10 +432,10 @@ are:
    "{{FullscreenKeyboardLock/browser}}"
    -

    Set this's [=keyboard lock flag=]. +

    Set this's keyboard lock flag.

    "{{FullscreenKeyboardLock/none}}"
    -

    Unset this's [=keyboard lock flag=]. +

    Unset this's keyboard lock flag.

  • Resolve promise with undefined. @@ -552,9 +552,9 @@ could be an open <{dialog}> element.

  • Return promise, and run the remaining steps in parallel. -

  • [=Release the keyboard lock=] for doc. +

  • Release the keyboard lock for doc. -

  • Run the [=fully unlock the screen orientation steps=] with doc. +

  • Run the fully unlock the screen orientation steps with doc.

  • If resize is true, resize doc's viewport to its "normal" dimensions. @@ -643,8 +643,8 @@ algorithm as part of the close request steps. This takes precedence over

    The user agent may end any fullscreen session without a close request or call to {{Document/exitFullscreen()}} whenever the user agent deems it necessary. -

    Users should be clearly notified when [=keyboard locking=] is active, possibly through browser UI -indicators. +

    Users should be clearly notified when keyboard locking is active, possibly through browser +UI indicators.

    There should be a simple and intuitive method for users to override keyboard locking, reverting control back to the system or user agent. @@ -712,16 +712,16 @@ them to intercept certain key inputs that would typically be handled by either t user agent. This is useful in scenarios such as gaming or remote desktop applications, where keys like ESC or function keys are integral to the application's functionality. -

    A [=keyboard lock=] enables web applications to capture and handle key inputs directly, bypassing -the default behavior typically executed by the user agent or operating system. Key events that would -normally trigger user agent or system-level actions are instead redirected to the web application in -fullscreen. Such key events (for individual keys or keyboard shortcuts) may either have no action -while [=keyboard lock=] is active, or it could still have the same action but allow the web page to -call {{Event/preventDefault()}} to cancel the action. +

    A keyboard lock enables web applications to capture and handle key inputs directly, +bypassing the default behavior typically executed by the user agent or operating system. Key events +that would normally trigger user agent or system-level actions are instead redirected to the web +application in fullscreen. Such key events (for individual keys or keyboard shortcuts) may either +have no action while keyboard lock is active, or it could still have the same action but +allow the web page to call {{Event/preventDefault()}} to cancel the action. -

    Whenever a [=document=]'s [=keyboard lock=] is changed from active to inactive, user agents must -deactivate the keyboard lock and restore the handling of keyboard inputs to the default behavior of -the user agent and the operating system. +

    Whenever a document's keyboard lock is changed from active to inactive, user agents +must deactivate the keyboard lock and restore the handling of keyboard inputs to the default +behavior of the user agent and the operating system.

    User agents should reserve an additional input for the purposes of exiting fullscreen. There are also some system-level key sequences or combinations that cannot be intercepted for security @@ -765,17 +765,17 @@ delivered with the document through which it is nested.

    This prevents e.g. content from third parties to go fullscreen without explicit permission. -

    When applying a [=keyboard lock=], only a limited set of keys, primarily those not involving +

    When applying a keyboard lock, only a limited set of keys, primarily those not involving system control or privacy risks (like Alt+Tab, Ctrl+Alt+Del), can be locked via the API. -

    When applying a [=keyboard lock=], user agents should implement safeguards to prevent abuse of +

    When applying a keyboard lock, user agents should implement safeguards to prevent abuse of this feature, such as allowing users to override the lock. -

    User agents may provide a user preference to ignore [=keyboard lock=] (with any granularity, e.g. -for a specific site, or globally). Similarly, some platforms might not have a keyboard, where user -agents may ignore the [=keyboard lock=] state. However, this should not affect the web-observable -behavior of the {{Element/requestFullscreen()}} method or be exposed in other ways, to avoid -fingerprinting. +

    User agents may provide a user preference to ignore keyboard lock (with any granularity, +e.g. for a specific site, or globally). Similarly, some platforms might not have a keyboard, where +user agents may ignore the keyboard lock state. However, this should not affect the +web-observable behavior of the {{Element/requestFullscreen()}} method or be exposed in other ways, +to avoid fingerprinting. From 21eb788a2e1f3f0c1ffe41846bf3c5d5f90528eb Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Wed, 6 May 2026 15:04:48 +0200 Subject: [PATCH 20/21] Remove 'release the keyboard lock' steps (covered by 'unfullscreen element') --- fullscreen.bs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index 574221a..bd36757 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -186,20 +186,6 @@ is unset.

    A document has keyboard lock active when its fullscreen element is not null and the fullscreen element's keyboard lock flag is set, and inactive otherwise. -

    -

    To release the keyboard lock for a document document, run these - steps: - -

      -
    1. If document's fullscreen element is null, then return. - -

    2. If document's fullscreen element's keyboard lock flag is unset, - then return. - -

    3. Unset document's fullscreen element's keyboard lock flag. -

    -
    -

    API

    @@ -552,8 +538,6 @@ could be an open <{dialog}> element.
     
      
  • Return promise, and run the remaining steps in parallel. -

  • Release the keyboard lock for doc. -

  • Run the fully unlock the screen orientation steps with doc.

  • If resize is true, resize doc's viewport to its "normal" dimensions. From 6424ebb5e941c4eff9d2035da59ccb975080af87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20J=C3=A4genstedt?= Date: Thu, 7 May 2026 13:23:25 +0200 Subject: [PATCH 21/21] Add suggestion from @saschanaz --- fullscreen.bs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fullscreen.bs b/fullscreen.bs index bd36757..cfc5cb2 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -711,6 +711,11 @@ behavior of the user agent and the operating system. also some system-level key sequences or combinations that cannot be intercepted for security reasons, such as Ctrl+Alt+Del on Windows. +

    For example, user agents that use the Esc key to exit fullscreen use keyboard lock to prevent +immediate exit on key press, and instead require a long press to exit fullscreen. Some such user +agents also implicitly grant partial keyboard lock to fullscreen session, in which case the Esc key +might be the only key that is affected by explicit keyboard lock. +

    Permissions Policy Integration