fix(core): preserve nested control focus on node click#2414
Open
puneetdixit200 wants to merge 1 commit into
Open
fix(core): preserve nested control focus on node click#2414puneetdixit200 wants to merge 1 commit into
puneetdixit200 wants to merge 1 commit into
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This change prevents node click handling from forcing focus back to the node wrapper when the original click target is a nested form/editor control.
The node still restores wrapper focus for ordinary node clicks, preserving the copy/paste focus behavior that the existing
requestAnimationFrame(...focus())path was added for.Motivation and Context
Fixes #2406.
Custom nodes can embed controls such as
input,select,textarea, buttons, or contenteditable editors. The currenthandleClickimplementation schedulescurrentTarget.focus()after every node click, so clicking one of those embedded controls can immediately move focus away from the control.This patch skips wrapper focus only when the click target is inside one of those nested controls and adds a regression test for that path.
Types of changes
Self Check before Merge
Verification:
pnpm test -- packages/core/__tests__/bugs/2406-spec.test.ts --runInBandpnpm exec eslint packages/core/src/view/node/BaseNode.tsx packages/core/__tests__/bugs/2406-spec.test.tspnpm --filter @logicflow/core run build:esmgit diff --check