Skip to content

Commit da93945

Browse files
committed
fix(web): Hebrew and Arabic diff comments read right to left
1 parent d54b84a commit da93945

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎apps/web/src/components/diffs/DiffCommentAnnotation.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useLayoutEffect, useRef, useState, type ReactNode } from "react";
33

44
import { Button } from "~/components/ui/button";
55
import { Textarea } from "~/components/ui/textarea";
6+
import { textDirection } from "~/textDirection";
67

78
import { isCommentSubmitShortcut } from "./commentSubmitShortcut";
89

@@ -65,7 +66,12 @@ export function DiffCommentAnnotation({
6566
onPointerDown={(event) => event.stopPropagation()}
6667
>
6768
<MessageCircle className="size-3.5 h-5 shrink-0 text-primary/70" aria-hidden="true" />
68-
<p className="min-w-0 flex-1 whitespace-pre-wrap text-sm leading-5">{displayedText}</p>
69+
<p
70+
className="min-w-0 flex-1 whitespace-pre-wrap text-sm leading-5"
71+
dir={textDirection(displayedText)}
72+
>
73+
{displayedText}
74+
</p>
6975
{onDelete ? (
7076
<span className="-my-1 -mr-1 flex shrink-0 opacity-0 transition-opacity group-hover/comment:opacity-100 focus-within:opacity-100 max-sm:opacity-100">
7177
<Button
@@ -95,6 +101,7 @@ export function DiffCommentAnnotation({
95101
autoFocus={focusOnMount}
96102
size="sm"
97103
value={displayedText}
104+
dir={textDirection(displayedText)}
98105
placeholder={placeholder}
99106
aria-label={`Comment on lines ${rangeLabel}`}
100107
onChange={(event) => (onTextChange ?? setLocalDraftText)(event.target.value)}

0 commit comments

Comments
 (0)