Skip to content
TypeScript

fix(web): show native caret and selection in file comments (#17554)

Fionn Gartlan0bdb5a8c6405
diff --git a/apps/web/src/components/diffs/DiffCommentAnnotation.tsx b/apps/web/src/components/diffs/DiffCommentAnnotation.tsx
index ca3d7e786ab..631d5ae26ee 100644
--- a/apps/web/src/components/diffs/DiffCommentAnnotation.tsx
+++ b/apps/web/src/components/diffs/DiffCommentAnnotation.tsx
@@ -59,7 +59,7 @@ export function DiffCommentAnnotation({
return (
<div
data-diff-comment-annotation
- className="group/comment flex min-w-0 items-start gap-2.5 border-s-2 border-primary/55 bg-primary/[0.045] px-3 py-2.5 font-sans text-foreground"
+ className="group/comment flex min-w-0 items-start gap-2.5 border-s-2 border-primary/55 bg-primary/[0.045] px-3 py-2.5 font-sans text-foreground selection:bg-primary selection:text-primary-foreground"
contentEditable={false}
onPointerDown={(event) => event.stopPropagation()}
>
@@ -81,10 +81,12 @@ export function DiffCommentAnnotation({
);
}
+ // Editable file annotations inherit Pierre's transparent native caret and selection.
+ // Comments use a native textarea, so they need their own visible text feedback.
return (
<div
data-diff-comment-annotation
- className="px-3 py-2 font-sans text-foreground"
+ className="px-3 py-2 font-sans text-foreground caret-foreground selection:bg-primary selection:text-primary-foreground"
contentEditable={false}
onPointerDown={(event) => event.stopPropagation()}
>