Skip to content

fix(ui): save input on blur in link editor + alt text editor#8037

Merged
mimecuvalo merged 4 commits intomainfrom
mime/link-save-on-blur
Feb 23, 2026
Merged

fix(ui): save input on blur in link editor + alt text editor#8037
mimecuvalo merged 4 commits intomainfrom
mime/link-save-on-blur

Conversation

@mimecuvalo
Copy link
Copy Markdown
Member

@mimecuvalo mimecuvalo commented Feb 19, 2026

In order to prevent users from accidentally losing their link edits when clicking outside the rich text link editor and alt text editor, this PR makes clicking away save the current value instead of discarding it. Closes #7673.

Change type

  • improvement

Test plan

  1. Create a geo shape and double-click to edit text
  2. Type some text, select it, click the link button in the rich text toolbar
  3. Type a URL (e.g. example.com)
  4. Click away from the link input (on the canvas)
  5. Verify the link is saved (text should be linked)
  6. Re-enter the shape, select the linked text, click the link button
  7. Press Escape - verify the link is NOT changed
  8. Re-enter the shape, select the linked text, click the link button
  9. Press Enter - verify the link is saved
  • Unit tests
  • End to end tests

Release notes

  • Fix rich text link editor to save the link when clicking outside instead of discarding changes.

Note

Medium Risk
Adds global pointerdown handlers that auto-commit edits; mistakes here could cause unintended saves or event ordering issues in the UI, though scope is limited to toolbar editors.

Overview
Prevents losing edits in the rich-text link editor and media alt-text editor by auto-saving on click-away: both LinkEditor and AltTextEditor now listen for pointerdown outside their respective toolbars and commit the current value (or remove the link if empty).

To support this, image/video toolbars share a new .tlui-media__toolbar class used for outside-click detection, and an e2e test is added to verify a link is saved when the user clicks outside the link input without pressing Enter.

Written by Cursor Bugbot for commit 9773390. This will update automatically on new commits. Configure here.

Clicking outside the rich text link editor now saves the current link
value instead of discarding it. Uses a ref guard to prevent double-saves
since Enter triggers both blur and onComplete.

Closes #7673
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
examples Ready Ready Preview Feb 23, 2026 0:31am
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
analytics Ignored Ignored Preview Feb 23, 2026 0:31am
chat-template Ignored Ignored Preview Feb 23, 2026 0:31am
tldraw-docs Ignored Ignored Preview Feb 23, 2026 0:31am
tldraw-shader Ignored Ignored Preview Feb 23, 2026 0:31am
workflow-template Ignored Ignored Preview Feb 23, 2026 0:31am

Request Review

@huppy-bot huppy-bot bot added the improvement Product improvement label Feb 19, 2026
@mimecuvalo mimecuvalo changed the title fix(ui): save link on blur in rich text link editor fix(ui): save input on blur in link editor + alt text editor Feb 20, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Copy link
Copy Markdown
Contributor

@MitjaBezensek MitjaBezensek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

handleRemoveLink()
}
}
document.addEventListener('pointerdown', handlePointerDown, { capture: true })
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we now set these up on every keypress since value is a dependency. We could store it in a separate ref?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ehh, i dunno, it's cheap to set/unset it. i'd rather not add a cached value in a ref. easy for it to get out-of-sync

@mimecuvalo mimecuvalo enabled auto-merge February 23, 2026 12:29
@mimecuvalo mimecuvalo added this pull request to the merge queue Feb 23, 2026
Merged via the queue into main with commit 557fcf7 Feb 23, 2026
19 of 20 checks passed
@mimecuvalo mimecuvalo deleted the mime/link-save-on-blur branch February 23, 2026 14:06
steveruizok added a commit that referenced this pull request Feb 27, 2026
Add 12 new entries from PRs merged since v4.4.0:
- Featured: click-through on transparent image pixels (#7942)
- API: enum-to-const-object refactor (#8084)
- Improvements: SVG sanitizer (#7896), save-on-blur (#8037)
- Bug fixes: cross-origin download (#8090), zero-size draw (#8067),
  rich text toolbar cleanup (#8050), zoom threshold (#8040),
  selection foreground fallback (#8011), sticky note SVG shadow (#7934),
  arrow frame clamping (#7932), zero pressure draw (#5693)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Product improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clicking outside link edit dialog should save instead of cancel

2 participants