From 4a2bc22484a615bf318ed7e549c6fd0ba0764cda Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Mon, 1 Nov 2021 13:40:50 -0400 Subject: [PATCH] Clarify that form state restoration does not fire events (But, it does fire formStateRestoreCallback, since that is explicitly used for synchronizing the custom element's internal state.) Closes #6853. --- source | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/source b/source index aaefc9551b6..c3d28328e1d 100644 --- a/source +++ b/source @@ -50251,6 +50251,10 @@ You cannot submit this form when the field is incorrect. to the user manipulating the controls, without having to then filter out the script's own changes to avoid an infinite loop.)

+

These events are also not fired when the browser changes the values of form + controls as part of state restoration during + navigation.

+ @@ -68811,9 +68815,10 @@ customElements.define("x-foo", class extends HTMLElement { argument.

  • When user agent updates a form-associated custom element's value on behalf of - a user, its formStateRestoreCallback is called, given the new value and a - string indicating a reason, "restore" or "autocomplete", as arguments.

  • + a user or as part of navigation, its formStateRestoreCallback is called, given the new value and a string indicating + a reason, "autocomplete" or "restore", as + arguments.

    We call these reactions collectively custom @@ -69298,17 +69303,18 @@ dictionary ValidityStateFlags { agent.

    When the user agent believes it is a good idea to restore a form-associated custom - element's state, for example after navigation or - restarting the user agent, they may enqueue a custom element callback reaction with - that element, callback name "formStateRestoreCallback", and an argument - list containing the state to be restored, and "restore".

    + element's state, for example after navigation or restarting the user agent, they may enqueue a + custom element callback reaction with that element, callback name "formStateRestoreCallback", an argument list containing the state to be + restored, and "restore".

    If the user agent has a form-filling assist feature, then when the feature is invoked, it may enqueue a custom element callback reaction with a form-associated custom element, callback name - "formStateRestoreCallback", and an argument list containing the state value + "formStateRestoreCallback", an argument list containing the state value determined by history of state value and some heuristics, and - "autocomplete".

    + "autocomplete".

    In general, the state is information specified by a user, and the submission value is a value after canonicalization @@ -88837,6 +88843,11 @@ new PaymentRequest(…); // Allowed to use data-x="attr-input-type-text">Text state or the Search state, if the persisted state includes the directionality of user input in such controls.

    + +

    Restoring the value of form controls as part of this process does not fire any + input or change events, but + can trigger the formStateRestoreCallback of form-associated custom elements.