Skip to content

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

Description

@nnn172

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/react-diagrams@7.0.2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions