Multi-link selection remains active after switching browser tabs without holding Shift

Author: nnn172Created Jun 26, 2025Updated Jun 26, 2025

Description: When returning to the demo tab after using the browser shortcut Ctrl+Shift+Tab (on Windows), selecting a link will trigger multi-selection even though the shift key is not held down.

Steps to Reproduce:

  1. Open the demo page: https://projectstorm.cloud/react-diagrams/?path=/story/advanced-usage--smart-routing
  2. Add multiple links between nodes.
  3. Click on any link to select it.
  4. Switch to another browser tab using Ctrl+Shift+Tab (Windows shortcut).
  5. Return to the demo tab.
  6. Click another link → Now both links are selected, even though Shift is not being held.

Expected Behavior: Clicking a new link without holding the Shift key should deselect the previous selection and select only the clicked link.

Actual Behavior: After switching tabs with Ctrl+Shift+Tab, the Shift key is somehow "sticky"—selecting another link adds it to the selection, resulting in multiple selected links unintentionally.

Environment: OS: Windows 10/11 Browser: [e.g. Chrome 125] Library version: @projectstorm/[email protected]

Reproduction URL: https://projectstorm.cloud/react-diagrams/?path=/story/advanced-usage--smart-routing

Additional Context: This seems like a Shift key state not being cleared properly when the tab focus is lost. Possibly related to event listeners not tracking keyup/keydown outside the window.

Source: projectstorm/react-diagrams