Skip to content

🐛 Fix copy/paste toolbar buttons - #442

Merged
MFA-X-AI merged 2 commits into
XpressAI:masterfrom
rabea-al:fix/copy-paste-toolbar-buttons
Aug 22, 2025
Merged

MFA-X-AI merged 2 commits into
XpressAI:masterfrom
rabea-al:fix/copy-paste-toolbar-buttons

Conversation

@rabea-al

Copy link
Copy Markdown
Contributor

Description

Problem

  • The Copy and Paste toolbar buttons were not working.
  • Root cause: the selection was being cleared on blur events, which also triggered when focus moved to the toolbar — leaving no active selection for the buttons to act on.

Fix

  • Replaced blur with focusout for more accurate focus handling.
  • Added a guard so focus changes to the toolbar don’t clear the canvas selection.
  • Removed unused listeners (blur duplication and contextmenu branch).

Result

  • Copy/Paste toolbar buttons now work correctly.
  • Node selection is preserved while using the toolbar, and only cleared when focus is truly lost.

Pull Request Type

  • Xircuits Core (Jupyterlab Related changes)
  • Xircuits Canvas (Custom RD Related changes)
  • Xircuits Component Library
  • Xircuits Project Template
  • Testing Automation
  • Documentation
  • Others (Please Specify)

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Tests

1. Toolbar Copy/Paste

  1. Place one or more nodes on the canvas.
  2. Select a node.
  3. Click the Copy or Cut button in the toolbar.
  4. Click the Paste button.
    ✅ A duplicate node appears as expected.

2. Focus Handling

  1. Select a node on the canvas.
  2. Move focus to a toolbar button (e.g., Copy).
    ✅ Node selection remains active.
  3. Move focus away from the canvas entirely (e.g., click outside the editor).
    ✅ Node selection is cleared.

Tested on? Specify Version.

  • Windows
  • Linux Fedora
  • Mac
  • Others (State here -> xxx )

@github-actions

Copy link
Copy Markdown

Binder 👈 Launch a binder notebook on branch rabea-al/xircuits/fix/copy-paste-toolbar-buttons

Comment thread src/XircuitsWidget.tsx Resolved
@MFA-X-AI
MFA-X-AI merged commit 07e7802 into XpressAI:master Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants