Skip to content

fix: Text box doesn't focus on first click - #199

Open
StickmanRed wants to merge 1 commit into
developmentfrom
StickmanRed-text-focus-fix
Open

fix: Text box doesn't focus on first click#199
StickmanRed wants to merge 1 commit into
developmentfrom
StickmanRed-text-focus-fix

Conversation

@StickmanRed

Copy link
Copy Markdown
Collaborator

Description

The gesture code in View.Project.js uses pointer capture to funnel mouse events onto the <canvas> element, which triggers an onclick event that defocuses the Text tool's text box.

This PR implements a hacky fix to avoid breaking the gesture code. tools/Text.js wraps the canvas onclick handler in a function that refocuses the text box then sets the onclick handler to the original handler.

Closes #96

Testing

  1. Switch to the Text tool.
  2. Press left mouse button and release in the same location. The cursor should be focused on the text box.
  3. Click anywhere else on the canvas to deselect the text.
  4. Click back on the text to select it. The text box should be focused again.
  5. Deselect the text.
  6. Press left mouse button on the text, but drag the cursor outside the text box and release. The text should be focused again. This behavior is different from Wick Editor 1.19.3, where the text box would be deselected.

Personally, I like having the text focused in this case. Not a bug, but a feature lol

@StickmanRed StickmanRed added the bug Something isn't working label Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] when creating a new text box, it is not focused

1 participant