code-server icon indicating copy to clipboard operation
code-server copied to clipboard

Mouse 4/5 button(Go Forward & Go Back function) is not working as expected because of the default feature of Chrome

Open ericzhucode opened this issue 4 years ago • 3 comments

In VSCode, we have mouse back forward to navigate feature. image There're keyboard shortcuts as well as mouse buttons(four and five) to do this action. In local VSCode, mouse buttons are working perfectly. However, in code server, since mouse button four and five is also performing as forward and back of the websites in chrome, it will not go forward and back between files in code server but change the current website. Meanwhile, go forward and go back is working properly in https://vscode.dev Is it possible to add an event to prevent this default action of chrome? Like

this._register(dom.addDisposableListener(window,'popState', () => { window.history.pushState(null, '', document.URL); }))

ericzhucode avatar Dec 02 '21 15:12 ericzhucode

Meanwhile, go forward and go back is working properly in https://vscode.dev

Ahh, I was going to ask you to test but you already did 👍 That's indeed a code-server issue then.

Is it possible to add an event to prevent this default action of chrome? Like

this._register(dom.addDisposableListener(window,'popState', () => {
window.history.pushState(null, '', document.URL);
}))

I wonder if this would have other unintended consequences? We'd have to double-check and investigate further.

jsjoeio avatar Dec 06 '21 17:12 jsjoeio

Hitting mouse button 4 will take me back to the previous folder or login screen using browser navigation rather than going back in code.

This browser extension (enabled only on my VSCode server pages) appears to have worked around this problem for me in Chromium Edge https://chrome.google.com/webstore/detail/ffmsb-freedom-for-mouse-s/najmjkgimjhilaleingfkhedncclmmaf?hl=en

I can navigate back and forth in code using mouse buttons 4/5 and I keep default browser behaviour in all other sites

Link found from an answer here: https://www.reddit.com/r/brave_browser/comments/o85hh4/how_do_i_disable_the_mouse_4_and_mouse_5_buttons/

HTH until a similar fix for this problem can be implemented natively

neilflatley avatar Jun 01 '22 17:06 neilflatley

@neilflatley Thank you for suggestion. I have tried this extension and very helpful. 😊

ericzhucode avatar Jun 02 '22 04:06 ericzhucode