Skip to content

Reload (command+R) persists field values on input elements after validation #5831

Open
@NikhilNanjappa

Description

@NikhilNanjappa

Description of the issue

My current application had v3.13.1 govuk-frontend JS file and v4.9.0 govuk-frontend npm package. I have recently upgraded both to the latest v5.9.0.

After updating, my cypress started failing. After investigation I noticed that the reload (command+R) was not clearing the validated field error values on the elements which resulted in test failure. I could ofcourse replicate this manually outside cypress env as well.

Previously, when I reload the page after validation, it used to clear the data from the fields. Has there been any changes made (to forms perhaps) that makes this behave differently now ? I'm just trying to place my finger on the cause.

FYI - no other changes have been made from my side except govuk-frontend update. Outside the update branch, it behaves as expected so it has to do something with the update I believe.

Steps to reproduce the issue

Image showing the issue

  1. Visit any page with form fields
  2. Create a validation error
  3. Reload the page (command+R)
  4. The values in the form field(s) persists

Actual vs expected behaviour

Previously, when I reload the page after validation, it used to clear the data from the fields. Its now persisting those values which is breaking some of the tests.

Environment (where applicable)

  • Operating system: OSX
  • Browser: Chrome
  • Browser version: Version 134.0.6998.166 (Official Build) (arm64)
  • GOV.UK Frontend Version: 5.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    text input🐛 bugSomething isn't working the way it should (including incorrect wording in documentation)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions