Closed Bug 1703080 Opened 4 years ago Closed 4 years ago

Firefox adds extra back/forward menu history entry on hashchange, which can lead to poor UX when the back button is pressed.

Categories

(Core :: DOM: Navigation, defect)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1645211
Webcompat Priority ?

People

(Reporter: twisniewski, Unassigned)

References

()

Details

If a page does something like the following:

document.addEventListener(
  "DOMContentLoaded",
  () => {
    if (!location.hash) location.hash = "/login";
  }
);

Firefox will add a history entry for the initial page-load, then a second one for the hash-changed location (both are visible in the back-button in the address bar). Chrome seems to only replace the initial page-load.

Depending on how the page behaves on the initial page-load, this can cause the user to be unable to go back to the previous page in history unless they long-click the back button and manually select to skip the previous site. For instance, this is presently occuring on the Citywide Banks site as seen in https://webcompat.com/issues/68511 (ie, visit example.org, then the bug URL).

It also seems that these "extra" history entries are being added when history.pushState is called, where only the hash changes (as noticed on https://www.dreamstime.com/photos-images/google-headquarters.html in https://webcompat.com/issues/67631)

Webcompat Priority: --- → ?

Johann, you worked on bug 1515073, maybe you have an idea of what's going on here?

Flags: needinfo?(jhofmann)

This will be changed/fixed as part of user interaction work in bug 1645211 .

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
Flags: needinfo?(jhofmann)
You need to log in before you can comment on or make changes to this bug.