From e6d3453ccf6763ae2dc7d469600a53f62f5fa649 Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Sun, 14 Jun 2026 23:39:08 -0700 Subject: [PATCH] fix: keep review annotation add-button visible on long selections (#5384) * fix: keep review annotation button visible * fix: improve review annotation add-button visibility on selection Make the plus button larger and styled with primary accent so it stays readable when it appears on active text selections, including long ones clamped inside the editor shell. Co-authored-by: Cursor --------- Co-authored-by: Cursor --- .../src/assets/rich-markdown-editor.css | 20 +++++++++++++++++-- .../editor/RichMarkdownAnnotationOverlay.tsx | 2 +- .../rich-markdown-review-annotations.test.ts | 6 +++--- .../rich-markdown-review-annotations.ts | 4 ++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/renderer/src/assets/rich-markdown-editor.css b/src/renderer/src/assets/rich-markdown-editor.css index 612d79e34..183cc39e0 100644 --- a/src/renderer/src/assets/rich-markdown-editor.css +++ b/src/renderer/src/assets/rich-markdown-editor.css @@ -193,9 +193,25 @@ .orca-diff-comment-add-btn.rich-markdown-comment-add-btn { display: flex; - width: 22px; - height: 22px; + width: 24px; + height: 24px; z-index: 1001; + /* Why: this button appears on active text selection; keep it readable without hover. */ + color: var(--primary); + border-color: color-mix(in srgb, var(--primary) 52%, var(--border)); + background: color-mix(in srgb, var(--primary) 14%, var(--background)); + box-shadow: + 0 1px 4px color-mix(in srgb, var(--foreground) 16%, transparent), + 0 0 0 1px color-mix(in srgb, var(--primary) 10%, transparent); +} + +.orca-diff-comment-add-btn.rich-markdown-comment-add-btn:hover { + color: var(--primary); + border-color: color-mix(in srgb, var(--primary) 68%, var(--border)); + background: color-mix(in srgb, var(--primary) 22%, var(--background)); + box-shadow: + 0 2px 8px color-mix(in srgb, var(--primary) 24%, transparent), + 0 0 0 1px color-mix(in srgb, var(--primary) 14%, transparent); } .rich-markdown-annotation-selection { diff --git a/src/renderer/src/components/editor/RichMarkdownAnnotationOverlay.tsx b/src/renderer/src/components/editor/RichMarkdownAnnotationOverlay.tsx index b668b243b..e52d495d7 100644 --- a/src/renderer/src/components/editor/RichMarkdownAnnotationOverlay.tsx +++ b/src/renderer/src/components/editor/RichMarkdownAnnotationOverlay.tsx @@ -48,7 +48,7 @@ export function RichMarkdownAnnotationOverlay({ onOpenPopover() }} > - + ) : null} {popover ? ( diff --git a/src/renderer/src/components/editor/rich-markdown-review-annotations.test.ts b/src/renderer/src/components/editor/rich-markdown-review-annotations.test.ts index b0f163b7c..b37140db0 100644 --- a/src/renderer/src/components/editor/rich-markdown-review-annotations.test.ts +++ b/src/renderer/src/components/editor/rich-markdown-review-annotations.test.ts @@ -6,11 +6,11 @@ import { describe('getRichMarkdownAnnotationButtonTop', () => { it('keeps the add-note button below short visible selections', () => { - expect(getRichMarkdownAnnotationButtonTop(120, 500)).toBe(126) + expect(getRichMarkdownAnnotationButtonTop(120, 500)).toBe(128) }) it('clamps the add-note button inside the visible editor shell for long selections', () => { - expect(getRichMarkdownAnnotationButtonTop(760, 500)).toBe(470) + expect(getRichMarkdownAnnotationButtonTop(760, 500)).toBe(468) }) }) @@ -20,6 +20,6 @@ describe('getRichMarkdownAnnotationButtonLeft', () => { }) it('clamps the add-note button inside narrow editor shells', () => { - expect(getRichMarkdownAnnotationButtonLeft(72)).toBe(42) + expect(getRichMarkdownAnnotationButtonLeft(72)).toBe(40) }) }) diff --git a/src/renderer/src/components/editor/rich-markdown-review-annotations.ts b/src/renderer/src/components/editor/rich-markdown-review-annotations.ts index 947bb4a70..0c3af1795 100644 --- a/src/renderer/src/components/editor/rich-markdown-review-annotations.ts +++ b/src/renderer/src/components/editor/rich-markdown-review-annotations.ts @@ -10,9 +10,9 @@ import { import type { RichMarkdownReviewNotePosition } from './rich-markdown-review-note-layout' import { findRichMarkdownSelectedTextRanges } from './rich-markdown-review-text-ranges' -const RICH_MARKDOWN_ANNOTATION_BUTTON_SIZE_PX = 22 +const RICH_MARKDOWN_ANNOTATION_BUTTON_SIZE_PX = 24 const RICH_MARKDOWN_ANNOTATION_EDGE_PADDING_PX = 8 -const RICH_MARKDOWN_ANNOTATION_SELECTION_GAP_PX = 6 +const RICH_MARKDOWN_ANNOTATION_SELECTION_GAP_PX = 8 const RICH_MARKDOWN_ANNOTATION_MIN_LEFT_PX = 56 const RICH_MARKDOWN_ANNOTATION_RIGHT_OFFSET_PX = 42 const RICH_MARKDOWN_ANNOTATION_POPOVER_WIDTH_PX = 420