Browser 'Back/forward cache' breaking back/forward in some cases

Created on 29 April 2025, 4 days ago

Problem/Motivation

Historically, https://www.drupal.org/project/webform/issues/2920443 was completed to resolve an issue where the user navigates back within their browser. This works well in the majority of cases, except where the browser Back/forward cache gets involved. In this case `onpopstate` is not run, and thus the previous page is not submitted correctly, breaking the form.

Steps to reproduce

  1. Create a multipage form
  2. Enable 'Browser Back Button Submit'
  3. Start using the form and end up on a page further than the starting page
  4. Do not interact with the page at all - no clicking, key presses etc
  5. Click browser back button (other back buttons do not reproduce issue eg. my shortcut for back on my mouse)
  6. Previous page not unsubmitted - causing broken submission

Proposed resolution

Unknown at this time. Have done some testing with onpagehide and event.persisted with no success at this time.

Remaining tasks

Investigation

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

6.2

Component

Code

Created by

🇬🇧United Kingdom alexj12

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024