From c7cb91d7d4f3bfc1163ac6d9aa9da8d94a0be792 Mon Sep 17 00:00:00 2001 From: Lu Wilson Date: Tue, 16 Apr 2024 13:40:01 +0100 Subject: [PATCH] Fix alt-duplicating shapes sometimes not working (#3488) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR fixes alt-duplicating shapes not working if you pointer-down'd on their text label. fixes https://github.com/orgs/tldraw/projects/41/views/1?pane=issue&itemId=59901721 ### Change Type - [x] `sdk` — Changes the tldraw SDK - [x] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [ ] `internal` — Does not affect user-facing stuff - [x] `bugfix` — Bug fix - [ ] `feature` — New feature - [ ] `improvement` — Improving existing features - [ ] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know ### Test Plan 1. Add a step-by-step description of how to test your PR here. 2. - [ ] Unit Tests - [ ] End to end tests ### Release Notes - Add a brief release note for your PR here. --- .../src/lib/tools/SelectTool/childStates/PointingShape.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/tldraw/src/lib/tools/SelectTool/childStates/PointingShape.ts b/packages/tldraw/src/lib/tools/SelectTool/childStates/PointingShape.ts index 2cba7c9a0..1355a8ac0 100644 --- a/packages/tldraw/src/lib/tools/SelectTool/childStates/PointingShape.ts +++ b/packages/tldraw/src/lib/tools/SelectTool/childStates/PointingShape.ts @@ -215,6 +215,9 @@ export class PointingShape extends StateNode { private startTranslating(info: TLPointerEventInfo) { if (this.editor.getInstanceState().isReadonly) return + + // Re-focus the editor, just in case the text label of the shape has stolen focus + this.editor.getContainer().focus() this.parent.transition('translating', info) }