Skip to content

fix(angular-board): restore focus when entering text editing - #1167

Merged
pubuzhixing8 merged 1 commit into
developfrom
xingxing/fix-text-editing-focus
Sep 22, 2026
Merged

pubuzhixing8 merged 1 commit into
developfrom
xingxing/fix-text-editing-focus

Conversation

@pubuzhixing8

Copy link
Copy Markdown
Collaborator

Summary

Double-clicking a mind map or flowchart node could enter text editing without giving the editable element browser focus. Directly assigning componentRef.instance.readonly did not refresh the OnPush component before AngularEditor.focus() ran: the DOM was still not contenteditable, so focus remained on BODY while Slate considered the editor focused.

  • Use ComponentRef.setInput() during dynamic component creation and updates. This marks the actual component view for change detection, allowing the existing synchronous detectChanges() call to apply readonly before focus or blur.
  • Add a regression test covering synchronous editability and browser focus, text selection, collapsed caret placement, exit, and re-entry. Assertions run before a scheduled render can hide the failed focus call.
  • Add a patch changeset for @plait/angular-board.

Related Issue

No linked issue.

Validation

  • Applicable checks pass: lint, build, and tests
  • Relevant documentation and examples were verified or are not applicable

Evidence and compatibility notes:

  • npx ng test angular-board --watch=false --progress=false --browsers=ChromeHeadlessCI: 2 tests passed.
  • The new regression test fails with direct property assignment plus the previous markForCheck() attempt and passes with this fix.
  • npm run build:angular-board: passed.
  • ESLint for both changed TypeScript files: passed.
  • Browser checks for flowchart and mind map nodes: double-click, immediate typing, exit, and re-entry passed. Arrow-key caret placement was also verified for a flowchart node.
  • The regression test and browser checks also passed without the local experimental Slate selection patch; this change does not require a slate-angular patch.
  • Preserves the existing select-all behavior on desktop edit entry and leaves the document format unchanged. Dynamic component props now go through Angular input handling.

Changeset

  • A changeset was added when required
  • No changeset is required

AI Assistance

  • Tool/model: Codex / GPT-6

Checklist

  • The title and description are in English, and the change is focused
  • Tests, documentation, and examples were updated when needed
  • Public API and data compatibility were considered

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying plait with  Cloudflare Pages  Cloudflare Pages

Latest commit: a1bf2dd
Status:🚫  Build failed.

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying plait-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: a1bf2dd
Status:🚫  Build failed.

View logs

@pubuzhixing8
pubuzhixing8 merged commit 7954d4b into develop Sep 22, 2026
1 of 3 checks passed
@pubuzhixing8
pubuzhixing8 deleted the xingxing/fix-text-editing-focus branch September 22, 2026 07:44
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.

1 participant