Multi-link selection remains active after switching browser tabs without holding Shift
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:
- Open the demo page: https://projectstorm.cloud/react-diagrams/?path=/story/advanced-usage--smart-routing
- Add multiple links between nodes.
- Click on any link to select it.
- Switch to another browser tab using Ctrl+Shift+Tab (Windows shortcut).
- Return to the demo tab.
- 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