Skip to content

feat: CommentPopover for better comment writing UX#220

Merged
backnotprop merged 2 commits intomainfrom
feat/comment-popover
Mar 4, 2026
Merged

feat: CommentPopover for better comment writing UX#220
backnotprop merged 2 commits intomainfrom
feat/comment-popover

Conversation

@backnotprop
Copy link
Owner

Summary

  • Replaces the cramped toolbar textarea (max-w-80 max-h-32) and awkward global comment inline form with a new CommentPopover component
  • Popover mode (w-96) provides a wider, auto-growing textarea with proper padding
  • Expand button opens a full dialog mode (max-w-xl) for long-form writing
  • Simplified AnnotationToolbar to menu-only — removed the entire input step (~100 lines)
  • Cmd/Ctrl+Enter to submit, Enter for newline (GitHub/Linear comment pattern)
  • Popover tracks anchor element position on scroll (stays pinned to highlighted content)
  • Image attachments work in both popover and dialog modes

Test plan

  • Select text → Comment → popover appears with proper size
  • Type long comment → expand to dialog → text persists → submit creates annotation
  • Type-to-comment (press key in menu step) → popover opens with char pre-filled
  • Global comment button → popover opens → submit creates global annotation
  • Code block hover → Comment → popover opens → submit creates annotation
  • Scroll while popover is open → popover stays pinned to content
  • Escape in dialog → collapse to popover. Escape in popover → close
  • Click outside popover → closes

Closes #219

🤖 Generated with Claude Code

backnotprop and others added 2 commits March 4, 2026 11:55
Replace the cramped toolbar textarea and awkward global comment inline
form with a new CommentPopover component that provides a proper writing
surface for long comments.

- New CommentPopover with popover mode (w-96) and expand-to-dialog mode
- Simplified AnnotationToolbar to menu-only (removed input step)
- Global comment button now opens CommentPopover instead of inline form
- Cmd/Ctrl+Enter to submit, Enter for newline (GitHub/Linear pattern)
- Popover tracks anchor element on scroll to stay pinned to content
- Image attachments supported in both modes

Closes #219

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Clear commentPopover state in highlighter CREATE handler when a new
  selection is made (prevents popover+toolbar coexisting)
- Wrap handleCommentClose in useCallback to prevent the click-outside
  effect from re-registering on every Viewer render

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@backnotprop
Copy link
Owner Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@backnotprop backnotprop merged commit 092538a into main Mar 4, 2026
3 checks passed
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.

Increase size of text area for comments

1 participant