Back button on macoS deskop Safari (WebKit) causing new tabs to open

AI-generated summary

A user, Neil_Evans, reports a bug in macOS desktop Safari (WebKit) where pressing the back button on a mouse—after navigating via anchor links in a topic containing images—sometimes opens a new tab displaying one of the images instead of going back. The issue does not occur without images or in Chromium. zogstrip attempts to reproduce the issue on try.discourse.org using both mouse and Safari’s built-in back button but cannot replicate it. Neil_Evans clarifies the bug only occurs with the mouse’s back button, not Safari’s UI button, and shares a video demonstrating the behavior. Despite multiple attempts, zogstrip still cannot reproduce the issue. Neil_Evans confirms a colleague successfully reproduced the bug on another MacBook using a mouse with a back button, suggesting the issue may be hardware- or timing-dependent. The problem appears specific to WebKit and mouse-triggered back navigation.

I have created a topic with anchors for navigation, and images included. When I use the section links at the top to jump to an anchor, then press “back” - Safari often open a new tab with one of the images from the topic in it - rather that going back. This is quite easy to recreate - and seems specific to images and WebKit. If I remove the images from the topic I do not get this problem - and it does not happen on Chromium.

1 Like

Can you repro on https://try.discourse.org?

3 Likes

Yes, try clicking around this topic using the anchor links at the top, then clicking “back” - and it will occasionally open a new tab with the image in it:

https://try.discourse.org/t/topic-to-repro-back-button-issues-on-safari-on-macos-desktop/1496

I’m afraid I’m not able to reproduce the issue :thinking:

1 Like

Ok - let me try again

Ahah - I can only recreate it using the “back” button on my mouse. I assumed the back button in Safari would behave the same, but it looks like it’s different? Or maybe I’m just a lot faster with the mouse button?

yeah, I tried that initially (I don’t even have the back/forward button in my Safari) and since I wasn’t able to reproduce I tried with the back/forward buttons as well…

2 Likes

Here is a recording of it happening on my screen - i did this just after loading the page:

Are you unable to recreate this - as shown in my video?

I’m afraid I’m not able to reproduce :grimacing:

1 Like

OK - thanks for trying. I will ask a colleague to try it on their laptop when next in the office and get back to you…

I asked one one of my colleagues to try this on their MacBook using Safari - with a mouse that had a back button - and they were able to recreate this easily?