Repository navigation
Middle-click causes forward-navigation #3008
Description
Activity
- addedkind/bugSomething isn't workingSomething isn't working
on Feb 1, 2026 Issue Validation
This is a valid bug. The v2 codebase is missing the middle-click prevention handler that existed in v1. In browsers, middle-click (button 1) fires the standard
clickevent in addition toauxclick, which causesonClickhandlers withnavigate()calls to trigger unintended navigation.Relevant Code
The core navigation components use
onClickhandlers without checkinge.button:packages/interface/src/components/SpacesSidebar/SpaceItem.tsx:238-250- Navigation on click without button filteringpackages/interface/src/routes/explorer/Sidebar.tsx:149-161- SidebarItem onClick handlerspackages/interface/src/routes/overview/DevicePanel.tsx:600-608- Location button onClick
These all call
navigate(path)or trigger state changes on any click, including middle-click.What's Happening
When user middle-clicks:
- Middle mouse button fires both
clickandauxclickevents - The
onClickhandlers in navigation components execute navigate()is called, causing forward navigation to a previously visited route- The cursor gets stuck in scroll-click mode because the native autoscroll behavior is interrupted
In v1, this was fixed in commit
55d2ec7a("[ENG-1663] Prevent middle-click opening new tab") by adding:useEffect(() => { const handleClick = (e: MouseEvent) => { if (e.button === 1) e.preventDefault(); }; document.addEventListener('auxclick', handleClick); return () => document.removeEventListener('auxclick', handleClick); }, []);
This handler is not present in the v2 codebase.
Potential Approaches
-
Global auxclick prevention (Recommended) - Add a global
auxclickhandler inApp.tsxorShellLayout.tsxthat prevents default for middle-click. This is the same approach used in v1. -
Button filtering in onClick handlers - Update all
onClickhandlers to checke.button === 0before navigating. More surgical but requires touching many files. -
Custom Link component - Create a wrapper component similar to v1's
Link.tsxthat handles middle-click properly, then migrate navigation to use it. -
React Router Link with proper handling - Use React Router's
<Link>component instead of buttons withnavigate(), then add auxclick prevention to prevent opening new tabs.
Investigation Notes
- This is a regression from v1 where the fix was explicitly implemented
- The issue specifically manifests on Windows because autoscroll (middle-click drag scrolling) is a Windows-native feature
- The cursor getting stuck is because the navigation interrupts the native autoscroll state machine
- Both the Overview page location buttons and sidebar navigation items are affected


Check for other issues
Issue description
Middle-click causes forward-navigation
Steps to reproduce
Platform and versions
Development tool versions (optional)
Stack trace
Additional context
No response
Code of Conduct