From 720c29fa4cc6854f33f08063edd28e6ecbe76d59 Mon Sep 17 00:00:00 2001 From: catch Date: Fri, 22 Mar 2024 15:24:40 +0000 Subject: [PATCH] Issue #3320467 by Liam Morland, nicrodgers, smustgrave, andypost, jonnyhocks, alexpott: form_build_id is a hidden input field and therefore should not have the autocomplete attribute --- core/lib/Drupal/Core/Form/FormBuilder.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php index cd4ccbc4fd6..8253b433a12 100644 --- a/core/lib/Drupal/Core/Form/FormBuilder.php +++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -729,17 +729,6 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS // submitted form value appears literally, regardless of custom #tree // and #parents being set elsewhere. '#parents' => ['form_build_id'], - // Prevent user agents from prefilling the build ID with earlier values. - // When the ajax command "update_build_id" is executed, the user agent - // will assume that a user interaction changed the field. Upon a soft - // reload of the page, the previous build ID will be restored in the - // input, causing subsequent ajax callbacks to access the wrong cached - // form build. Setting the autocomplete attribute to "off" will tell the - // user agent to never reuse the value. - // @see https://www.w3.org/TR/2011/WD-html5-20110525/common-input-element-attributes.html#the-autocomplete-attribute - '#attributes' => [ - 'autocomplete' => 'off', - ], ]; // Add a token, based on either #token or form_id, to any form displayed to