Skip to content

fix(remark): cancel empty annotation on outside click; replace clear-all two-click with undo toast#83

Merged
xicilion merged 1 commit into
markdown-viewer:mainfrom
liyuankui:fix/remark-post-merge-bugs
May 15, 2026
Merged

fix(remark): cancel empty annotation on outside click; replace clear-all two-click with undo toast#83
xicilion merged 1 commit into
markdown-viewer:mainfrom
liyuankui:fix/remark-post-merge-bugs

Conversation

@liyuankui
Copy link
Copy Markdown
Contributor

Fixes two issues reported by @xicilion in #74 after PR #76 was merged.

Bug 1: Clicking outside popup without annotating leaves empty annotation

Root cause: The annotation was created immediately on text selection, and outsideHandler saved it regardless of whether the user did anything.

Fix: Track whether the user interacted (changed a color or typed a note). If they click outside without any interaction, the annotation is silently removed — same as clicking Cancel.

Bug 3: Clear all button doesn't work (two-click UX too hidden)

Root cause: The two-click confirmation (first click → ⚠️, second click → delete) was invisible to users. They'd click once, see the icon change, and wait for it to reset — appearing broken.

Fix: Single click clears immediately + shows a 5-second undo toast (same pattern as single-item delete). Consistent, discoverable, reversible.


Bug 2 (multiple annotations per block with whole-block selection) is a design question — left for a follow-up discussion.

…all two-click with undo toast

- Bug 1: clicking outside popup without interacting now silently removes
  the annotation instead of leaving an empty entry; annotation is kept
  only if user explicitly chose a color or typed a note
- Bug 3: clear-all no longer uses a confusing two-click confirmation;
  single click clears immediately with a 5-second undo toast (consistent
  with single-item delete behaviour)
- i18n: add remark_all_cleared key, remove unused remark_confirm_clear

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants