Skip to content

Fix quick-add dialog moving instead of closing when clicking the workspace - #6027

Merged
knolleary merged 1 commit into
node-red:mainfrom
NUAAwqy:fix-quick-add-context-menu-reopen
Oct 21, 2026
Merged

knolleary merged 1 commit into
node-red:mainfrom
NUAAwqy:fix-quick-add-context-menu-reopen

Conversation

@NUAAwqy

@NUAAwqy NUAAwqy commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Proposed changes

Fixes #5783 - quick-add dialog "moves" to every workspace click instead of closing when it was opened from the context menu (Insert > Node).

As @knolleary suspected, it is an event-handler ordering issue: the context-menu path leaves mouse_mode === RED.state.QUICK_JOINING set, so the workspace mousedown handler in view.js re-invokes showQuickAddDialog on each click. The element-level d3 handler runs before the document-level typeSearch handler, and typeSearch.show() calls $(document).off('mousedown.red-ui-type-search') before the current event can bubble - so handleMouseActivity never runs, the cancel callback never fires, and the dialog just repositions. The cmd/ctrl path avoids this because the keyup handler clears QUICK_JOINING before the next click arrives.

The fix is one line: guard the QUICK_JOINING branch with RED.typeSearch.isVisible() (the same accessor view.js already uses at the keyboard-handling site). While the dialog is visible the click bubbles normally, closing the dialog and running the cancel callback. The keep-adding behavior (clicking the canvas to reopen the dialog after inserting a node) is preserved because the dialog is hidden between additions, so isVisible() is false.

Checklist

  • I have read the contribution guidelines
  • For non-trivial changes, I discussed them with the maintainers first (this implements the mechanism identified by @knolleary in the issue thread)
  • In case changes affect UI, I have passed a short video or screenshots showing the change (no visual change for correct flows; see the reproduction video in Quick-add behavior when called from context menu #5783 for the broken behavior this removes)
  • I have added tests, or extended existing tests, to cover my changes if appropriate

This interaction path has no automated test coverage in the repo; verification was node --check on the edited file plus tracing both flows (context-menu open -> click closes; cmd/ctrl open -> unchanged; keep-adding reopen -> unchanged). I can extend a jsdom-based editor test if maintainers want one for this.

AI disclosure: this change was drafted with assistance from an AI coding agent, reviewed by the author, and verified as described above.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: NUAAwqy / name: NUAAwqy (7906a91)

@knolleary

Copy link
Copy Markdown
Member

/easycla

@knolleary
knolleary changed the base branch from main to dev October 21, 2026 09:06
@knolleary
knolleary changed the base branch from dev to main October 21, 2026 09:06
@knolleary

Copy link
Copy Markdown
Member

I see you have signed the CLA from PR #6026 - but this PR has not refreshed to show that. Can you push an empty commit to your branch to force the EasyCLA bot to recheck? The /easycla command should have triggered it, but that hasn't happened.

NUAAwqy pushed a commit to NUAAwqy/node-red that referenced this pull request Oct 21, 2026
@NUAAwqy
NUAAwqy force-pushed the fix-quick-add-context-menu-reopen branch from 01736a8 to 7906a91 Compare October 21, 2026 09:29
@knolleary
knolleary merged commit 5a8c3c9 into node-red:main Oct 21, 2026
3 checks passed
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.

Quick-add behavior when called from context menu

2 participants