alphagov / govuk-browser-extension

Chrome and Firefox extension for developers working on GOV.UK.
22 stars 5 forks source link

Extension doesn't preserve browser history #153

Open ChrisBAshton opened 2 years ago

ChrisBAshton commented 2 years ago

When using the extension links such as Production, Staging and Integration, the URL changes as expected. However, pressing the Back button does not take you back to the previous page.

We should look into using the History API to push the change to the history array, to fix the back button behaviour.

patrickpatrickpatrick commented 1 year ago

I see this was reported a while ago but it's still the case and it's still very annoying when trying to debug something.

patrickpatrickpatrick commented 1 year ago

Investigating this with the following journey:

On Chrome, the page that you end up on is the GOV.UK homepage and not Benefits (which is what would be expected). In Firefox this issue does not occur, it will go back to Benefits. When running this with Developer Mode turned on in Chrome extensions, I see the following console output:

Navigation to https://www.gov.uk/ was restored from back/forward cache (see https://web.dev/bfcache/)

The history (when right clicking the background) appears to be correct. Benefits appears in the dropdown and can be navigated to. When pressing back however, we get on the homepage.