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 <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jinjing
2026-06-14 23:39:08 -07:00
committed by GitHub
co-authored by Cursor
parent d5df9b7998
commit e6d3453ccf
4 changed files with 24 additions and 8 deletions
@@ -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 {
@@ -48,7 +48,7 @@ export function RichMarkdownAnnotationOverlay({
onOpenPopover()
}}
>
<Plus className="size-3" />
<Plus className="size-3.5" strokeWidth={2.5} />
</button>
) : null}
{popover ? (
@@ -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)
})
})
@@ -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