Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

💬 fix: Mirror Chat Messages, Markdown and Code Blocks for RTL (#17267)

Marco Berettafd85fed204ad
diff --git a/client/src/components/Artifacts/ArtifactVersion.tsx b/client/src/components/Artifacts/ArtifactVersion.tsx
index a571fb406b..394d1b6fb3 100644
--- a/client/src/components/Artifacts/ArtifactVersion.tsx
+++ b/client/src/components/Artifacts/ArtifactVersion.tsx
@@ -82,7 +82,7 @@ export default function ArtifactVersion({
/>
}
items={dropdownItems}
- className={isSmallScreen ? '' : 'absolute right-0 top-0 mt-2'}
+ className={isSmallScreen ? '' : 'absolute inset-e-0 top-0 mt-2'}
/>
);
}
diff --git a/client/src/components/Artifacts/Artifacts.tsx b/client/src/components/Artifacts/Artifacts.tsx
index 3906c890f4..43707ba9fe 100644
--- a/client/src/components/Artifacts/Artifacts.tsx
+++ b/client/src/components/Artifacts/Artifacts.tsx
@@ -495,7 +495,7 @@ export default function Artifacts() {
'h-full overflow-hidden shadow-2xl',
isVisible && !isClosing
? 'translate-x-0 opacity-100 transition-all duration-350'
- : 'translate-x-5 opacity-0 transition-all duration-300',
+ : 'translate-x-5 opacity-0 transition-all duration-300 rtl:-translate-x-5',
),
)}
style={isMobile ? { height: isFullscreen ? '100%' : `${height}vh` } : undefined}
@@ -533,7 +533,7 @@ export default function Artifacts() {
'flex items-center transition-all duration-500 motion-reduce:transition-none',
isVisible && !isClosing
? 'translate-x-0 opacity-100'
- : '-translate-x-2 opacity-0',
+ : '-translate-x-2 opacity-0 rtl:translate-x-2',
)}
>
<Radio
@@ -641,7 +641,7 @@ export default function Artifacts() {
)}
>
{isUndocked ? (
- <PanelRight className="size-4" aria-hidden="true" />
+ <PanelRight className="size-4 rtl:-scale-x-100" aria-hidden="true" />
) : (
<PictureInPicture2 className="size-4" aria-hidden="true" />
)}
diff --git a/client/src/components/Chat/BackgroundTasks/Card.tsx b/client/src/components/Chat/BackgroundTasks/Card.tsx
index 6653924bff..9b911e048c 100644
--- a/client/src/components/Chat/BackgroundTasks/Card.tsx
+++ b/client/src/components/Chat/BackgroundTasks/Card.tsx
@@ -85,7 +85,7 @@ function TaskCard({
setVisited(true);
setOpen((value) => !value);
}}
- className="text-text-primary focus-visible:ring-focus-control flex max-w-full items-start gap-1 rounded text-left text-sm focus-visible:ring-2 focus-visible:outline-none"
+ className="text-text-primary focus-visible:ring-focus-control flex max-w-full items-start gap-1 rounded text-start text-sm focus-visible:ring-2 focus-visible:outline-none"
>
<span className="line-clamp-2 break-words">
<span className={cn(active && 'shimmer')}>{title}</span>
diff --git a/client/src/components/Chat/Input/AddedConvo.tsx b/client/src/components/Chat/Input/AddedConvo.tsx
index 86f75c35f2..1d7641cd85 100644
--- a/client/src/components/Chat/Input/AddedConvo.tsx
+++ b/client/src/components/Chat/Input/AddedConvo.tsx
@@ -37,7 +37,7 @@ export default function AddedConvo({
return null;
}
return (
- <div className="flex items-start gap-4 py-2.5 pr-1.5 pl-3 text-sm">
+ <div className="flex items-start gap-4 py-2.5 ps-3 pe-1.5 text-sm">
<span className="mt-0 flex h-6 w-6 shrink-0 items-center justify-center">
<div className="icon-md">
<EndpointIcon
diff --git a/client/src/components/Chat/Input/AskUserQuestionPopover.tsx b/client/src/components/Chat/Input/AskUserQuestionPopover.tsx
index a8341ae27e..2f469e3791 100644
--- a/client/src/components/Chat/Input/AskUserQuestionPopover.tsx
+++ b/client/src/components/Chat/Input/AskUserQuestionPopover.tsx
@@ -206,7 +206,7 @@ function AskUserQuestionPopoverPanel({
handlePopoverKeyDown(e);
}}
>
- <div className="text-text-secondary flex shrink-0 items-start justify-between gap-2 p-1 pl-2">
+ <div className="text-text-secondary flex shrink-0 items-start justify-between gap-2 p-1 ps-2">
<div className="max-h-[24vh] min-w-0 overflow-y-auto pt-1">
<p className="text-text-primary text-sm font-medium [overflow-wrap:anywhere]">
{liveAsk.question.question}
@@ -265,7 +265,7 @@ function AskUserQuestionPopoverPanel({
onClick={() => submit(composerText)}
>
{localize('com_ui_submit')}
- <CornerDownLeft className="ml-1.5 h-4 w-4" aria-hidden="true" />
+ <CornerDownLeft className="ms-1.5 h-4 w-4 rtl:-scale-x-100" aria-hidden="true" />
</Button>
)}
</div>
diff --git a/client/src/components/Chat/Input/CodeApprovalMenu.tsx b/client/src/components/Chat/Input/CodeApprovalMenu.tsx
index 73f88bde4e..926f71e525 100644
--- a/client/src/components/Chat/Input/CodeApprovalMenu.tsx
+++ b/client/src/components/Chat/Input/CodeApprovalMenu.tsx
@@ -149,7 +149,7 @@ export default function CodeApprovalMenu({
className={cn(chipMenuItemClasses(isSelected), 'items-start')}
>
<Icon className="text-text-secondary mt-0.5 size-4 shrink-0" aria-hidden="true" />
- <div className="min-w-0 flex-1 text-left">
+ <div className="min-w-0 flex-1 text-start">
<div className="text-text-primary text-sm font-medium">{localize(label)}</div>
<p className="text-text-secondary text-xs">{localize(description)}</p>
</div>
diff --git a/client/src/components/Chat/Input/CodeWorkspaceMenu.tsx b/client/src/components/Chat/Input/CodeWorkspaceMenu.tsx
index e29d79de30..2adce34a77 100644
--- a/client/src/components/Chat/Input/CodeWorkspaceMenu.tsx
+++ b/client/src/components/Chat/Input/CodeWorkspaceMenu.tsx
@@ -255,7 +255,7 @@ function EnvironmentWorkspaces({
value={value}
checked={currentCheckout === value}
hideOnClick={hideOnClick}
- className={cn(menuItemClasses(currentCheckout === value), 'pl-8')}
+ className={cn(menuItemClasses(currentCheckout === value), 'ps-8')}
onChange={() =>
value === 'auto'
? onSelect(
@@ -391,7 +391,7 @@ function GitContext({
className="text-text-secondary mt-0.5 size-4 shrink-0"
aria-hidden="true"
/>
- <span className="min-w-0 flex-1 text-left">
+ <span className="min-w-0 flex-1 text-start">
<span className="text-text-primary block text-sm font-medium">
{localize(label)}
</span>
@@ -842,7 +842,7 @@ export default function CodeWorkspaceMenu({
}}
>
<Monitor className="text-text-secondary size-4 shrink-0" aria-hidden="true" />
- <span className="text-text-primary min-w-0 flex-1 truncate text-left text-sm">
+ <span className="text-text-primary min-w-0 flex-1 truncate text-start text-sm">
{candidate.name ?? candidate.id}
</span>
{workspace.mode === 'attached' && environmentIds.has(candidate.id) && (
@@ -953,7 +953,7 @@ export default function CodeWorkspaceMenu({
className={menuItemClasses()}
>
<ConfirmIcon className="text-text-secondary size-4 shrink-0" aria-hidden="true" />
- <span className="text-text-primary min-w-0 flex-1 truncate text-left text-sm font-medium">
+ <span className="text-text-primary min-w-0 flex-1 truncate text-start text-sm font-medium">
{transitionText.label}
</span>
</Ariakit.MenuItem>
@@ -970,7 +970,7 @@ export default function CodeWorkspaceMenu({
className="text-text-secondary mt-0.5 size-4 shrink-0"
aria-hidden="true"
/>
- <div className="min-w-0 flex-1 text-left">
+ <div className="min-w-0 flex-1 text-start">
<div className="text-text-primary truncate text-sm font-medium">
{localize('com_ui_code_workspace_detach')}
</div>
diff --git a/client/src/components/Chat/Input/CollapseChat.tsx b/client/src/components/Chat/Input/CollapseChat.tsx
index a209be8056..04bf6f231f 100644
--- a/client/src/components/Chat/Input/CollapseChat.tsx
+++ b/client/src/components/Chat/Input/CollapseChat.tsx
@@ -23,7 +23,7 @@ const CollapseChat = ({
: localize('com_ui_collapse_chat');
return (
- <div className="relative ml-auto items-end justify-end">
+ <div className="relative ms-auto items-end justify-end">
<TooltipAnchor
description={description}
render={
diff --git a/client/src/components/Chat/Input/Composer/Catalog.tsx b/client/src/components/Chat/Input/Composer/Catalog.tsx
index 20d727539e..f1a6b43fc2 100644
--- a/client/src/components/Chat/Input/Composer/Catalog.tsx
+++ b/client/src/components/Chat/Input/Composer/Catalog.tsx
@@ -178,7 +178,7 @@ export function CatalogContent({
controls ride inside it as a sticky header, so they share the cards'
exact width whether the scrollbar takes space or overlays; the small
left inset keeps the search field's focus ring from being clipped. */}
- <div className="-mr-5 -ml-1 min-h-0 flex-1 overflow-y-auto pr-5 pl-1">
+ <div className="-ms-1 -me-5 min-h-0 flex-1 overflow-y-auto ps-1 pe-5">
<div className="bg-surface-dialog sticky top-0 z-10 flex flex-wrap items-center gap-2 pt-1 pb-3">
<div className="min-w-0 flex-1">
<Input
diff --git a/client/src/components/Chat/Input/Composer/Files.tsx b/client/src/components/Chat/Input/Composer/Files.tsx
index 3561d476f5..e9893fabe3 100644
--- a/client/src/components/Chat/Input/Composer/Files.tsx
+++ b/client/src/components/Chat/Input/Composer/Files.tsx
@@ -108,7 +108,7 @@ const FileCard = memo(function FileCard({ file, onAttach, onPreview, disabled }:
type="button"
onClick={() => onAttach(file)}
disabled={disabled}
- className="focus-visible:ring-ring-primary flex h-full w-full cursor-pointer flex-col gap-2 rounded-2xl p-4 text-left focus:outline-hidden focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50"
+ className="focus-visible:ring-ring-primary flex h-full w-full cursor-pointer flex-col gap-2 rounded-2xl p-4 text-start focus:outline-hidden focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50"
>
<span className="flex w-full min-w-0 items-start gap-3">
<Thumbnail file={file} />
@@ -120,7 +120,7 @@ const FileCard = memo(function FileCard({ file, onAttach, onPreview, disabled }:
<span className="text-text-secondary mt-auto text-xs">{formatDate(file)}</span>
</button>
{canPreview && (
- <span className="absolute right-2 bottom-2">
+ <span className="absolute inset-e-2 bottom-2">
<IconButton
size="xs"
shape="square"
diff --git a/client/src/components/Chat/Input/Composer/Palette.tsx b/client/src/components/Chat/Input/Composer/Palette.tsx
index e5f23781a8..b0964b7614 100644
--- a/client/src/components/Chat/Input/Composer/Palette.tsx
+++ b/client/src/components/Chat/Input/Composer/Palette.tsx
@@ -1049,7 +1049,7 @@ function Palette({
{checked && (
<span
aria-hidden="true"
- className="bg-text-primary absolute inset-y-1 left-0 w-0.5 rounded-full"
+ className="bg-text-primary absolute inset-y-1 inset-s-0 w-0.5 rounded-full"
/>
)}
<Button
@@ -1126,7 +1126,7 @@ function Palette({
</div>
)}
{canFavorite && (
- <div role="gridcell" className="flex shrink-0 items-center pr-1">
+ <div role="gridcell" className="flex shrink-0 items-center pe-1">
<span className={ROW_ACTION_REVEAL}>
<IconButton
size="xs"
diff --git a/client/src/components/Chat/Input/Files/FileContainer.tsx b/client/src/components/Chat/Input/Files/FileContainer.tsx
index f146277e05..e7c295d8c5 100644
--- a/client/src/components/Chat/Input/Files/FileContainer.tsx
+++ b/client/src/components/Chat/Input/Files/FileContainer.tsx
@@ -84,7 +84,7 @@ const FileContainer = ({
<div className="flex flex-row items-center gap-2">
<FilePreview file={file} fileType={fileType} className="relative" />
<div className="overflow-hidden">
- <div className="truncate font-medium" title={visibleName}>
+ <div dir="auto" className="truncate font-medium" title={visibleName}>
{visibleName}
</div>
{subtitleAction != null ? (
@@ -103,7 +103,7 @@ const FileContainer = ({
* center still opens the editor. The colour shift answers focus as well as
* hover: the ring already announces focus, but leaving the two input modes
* with different feedback is a difference with no reason behind it. */
- 'text-text-secondary hover:text-text-primary focus-visible:text-text-primary pointer-events-auto relative z-10 inline-block max-w-full truncate rounded text-left align-middle leading-4 underline underline-offset-2',
+ 'text-text-secondary hover:text-text-primary focus-visible:text-text-primary pointer-events-auto relative z-10 inline-block max-w-full truncate rounded text-start align-middle leading-4 underline underline-offset-2',
focusRing,
)}
>
diff --git a/client/src/components/Chat/Input/Files/FileUpload.tsx b/client/src/components/Chat/Input/Files/FileUpload.tsx
index a59323c7a2..aa80f8f97e 100644
--- a/client/src/components/Chat/Input/Files/FileUpload.tsx
+++ b/client/src/components/Chat/Input/Files/FileUpload.tsx
@@ -78,13 +78,13 @@ const FileUpload: React.FC<FileUploadProps> = ({
size="sm"
onClick={handleClick}
className={cn(
- 'text-text-secondary hover:bg-surface-hover hover:text-status-success focus:ring-text-primary mr-1 flex h-auto cursor-pointer items-center rounded bg-transparent px-2 py-1 text-xs font-normal transition-colors',
+ 'text-text-secondary hover:bg-surface-hover hover:text-status-success focus:ring-text-primary me-1 flex h-auto cursor-pointer items-center rounded bg-transparent px-2 py-1 text-xs font-normal transition-colors',
statusColor,
containerClassName,
)}
aria-label={statusText}
>
- <FileUp className="mr-1 flex size-5.5 items-center stroke-1" aria-hidden="true" />
+ <FileUp className="me-1 flex size-5.5 items-center stroke-1" aria-hidden="true" />
<span className="flex text-xs">{statusText}</span>
</Button>
<input
diff --git a/client/src/components/Chat/Input/Files/ImagePreview.tsx b/client/src/components/Chat/Input/Files/ImagePreview.tsx
index 5241048242..05088d9cf9 100644
--- a/client/src/components/Chat/Input/Files/ImagePreview.tsx
+++ b/client/src/components/Chat/Input/Files/ImagePreview.tsx
@@ -188,7 +188,7 @@ const ImagePreview = ({
onClick={() => handleOpenChange(false)}
variant="media"
size="icon"
- className="absolute top-4 right-4 z-20"
+ className="absolute inset-e-4 top-4 z-20"
aria-label={localize('com_ui_close')}
>
<X className="size-5" aria-hidden="true" />
diff --git a/client/src/components/Chat/Input/Files/RemoveFile.tsx b/client/src/components/Chat/Input/Files/RemoveFile.tsx
index a61c58a4aa..32cccc8bf2 100644
--- a/client/src/components/Chat/Input/Files/RemoveFile.tsx
+++ b/client/src/components/Chat/Input/Files/RemoveFile.tsx
@@ -15,7 +15,7 @@ export default function RemoveFile({
<button
type="button"
data-remove-file
- className="bg-surface-secondary hover:bg-surface-primary absolute top-1 right-1 translate-x-1/2 -translate-y-1/2 rounded-full p-0.5 transition-colors duration-200"
+ className="bg-surface-secondary hover:bg-surface-primary absolute inset-e-1 top-1 translate-x-1/2 -translate-y-1/2 rounded-full p-0.5 transition-colors duration-200 rtl:-translate-x-1/2"
onClick={onRemove}
disabled={disabled}
aria-label={label ?? localize('com_ui_attach_remove')}
diff --git a/client/src/components/Chat/Input/Files/SourceIcon.tsx b/client/src/components/Chat/Input/Files/SourceIcon.tsx
index b8ce8a1033..ffc7317e89 100644
--- a/client/src/components/Chat/Input/Files/SourceIcon.tsx
+++ b/client/src/components/Chat/Input/Files/SourceIcon.tsx
@@ -21,7 +21,7 @@ const sourceToClassname = {
};
const defaultClassName =
- 'absolute right-0 bottom-0 rounded-full p-[0.15rem] text-text-secondary transition-colors';
+ 'absolute inset-e-0 bottom-0 rounded-full p-[0.15rem] text-text-secondary transition-colors';
export default function SourceIcon({
source,
diff --git a/client/src/components/Chat/Input/Files/Table/Columns.tsx b/client/src/components/Chat/Input/Files/Table/Columns.tsx
index 2e9c7fed7e..2f8b6c7543 100644
--- a/client/src/components/Chat/Input/Files/Table/Columns.tsx
+++ b/client/src/components/Chat/Input/Files/Table/Columns.tsx
@@ -98,7 +98,7 @@ export const columns: ColumnDef<TFile>[] = [
aria-current={sortState ? 'true' : 'false'}
>
{localize('com_ui_name')}
- <SortIcon className="ml-2 h-3 w-4 sm:h-4 sm:w-4" />
+ <SortIcon className="ms-2 h-3 w-4 sm:h-4 sm:w-4" />
</Button>
}
/>
@@ -157,7 +157,7 @@ export const columns: ColumnDef<TFile>[] = [
aria-current={sortState ? 'true' : 'false'}
>
{localize('com_ui_date')}
- <SortIcon className="ml-2 h-3 w-4 sm:h-4 sm:w-4" />
+ <SortIcon className="ms-2 h-3 w-4 sm:h-4 sm:w-4" />
</Button>
}
/>
@@ -276,7 +276,7 @@ export const columns: ColumnDef<TFile>[] = [
aria-current={sortState ? 'true' : 'false'}
>
{localize('com_ui_size')}
- <SortIcon className="ml-2 h-3 w-4 sm:h-4 sm:w-4" />
+ <SortIcon className="ms-2 h-3 w-4 sm:h-4 sm:w-4" />
</Button>
}
/>
diff --git a/client/src/components/Chat/Input/Files/Table/DataTable.tsx b/client/src/components/Chat/Input/Files/Table/DataTable.tsx
index 06b09418eb..3c4330309b 100644
--- a/client/src/components/Chat/Input/Files/Table/DataTable.tsx
+++ b/client/src/components/Chat/Input/Files/Table/DataTable.tsx
@@ -139,7 +139,7 @@ export default function DataTable<TData, TValue>({ columns, data }: DataTablePro
) : (
<TrashIcon className="text-text-destructive size-3.5 sm:size-4" />
)}
- {!isSmallScreen && <span className="ml-2">{localize('com_ui_delete')}</span>}
+ {!isSmallScreen && <span className="ms-2">{localize('com_ui_delete')}</span>}
</Button>
<FilterInput
inputId="files-filter"
@@ -255,7 +255,7 @@ export default function DataTable<TData, TValue>({ columns, data }: DataTablePro
</div>
<div className="flex items-center justify-end gap-2 py-4">
- <div className="text-text-secondary ml-2 flex-1 truncate text-xs sm:ml-4 sm:text-sm">
+ <div className="text-text-secondary ms-2 flex-1 truncate text-xs sm:ms-4 sm:text-sm">
<span className="hidden sm:inline">
{localize('com_files_number_selected', {
0: `${table.getFilteredSelectedRowModel().rows.length}`,
diff --git a/client/src/components/Chat/Input/Files/Table/SortFilterHeader.tsx b/client/src/components/Chat/Input/Files/Table/SortFilterHeader.tsx
index 3bc816599a..01c26318c8 100644
--- a/client/src/components/Chat/Input/Files/Table/SortFilterHeader.tsx
+++ b/client/src/components/Chat/Input/Files/Table/SortFilterHeader.tsx
@@ -58,7 +58,7 @@ export function SortFilterHeader<TData, TValue>({
onClick: () => column.setFilterValue(value),
icon: <ListFilter className="icon-sm text-text-secondary" aria-hidden="true" />,
show: true,
- className: isActive ? 'border-l-2 border-l-border-xheavy' : '',
+ className: isActive ? 'border-s-2 border-s-border-xheavy' : '',
});
}
});
diff --git a/client/src/components/Chat/Input/MentionItem.tsx b/client/src/components/Chat/Input/MentionItem.tsx
index 88900bda23..d901bd64c5 100644
--- a/client/src/components/Chat/Input/MentionItem.tsx
+++ b/client/src/components/Chat/Input/MentionItem.tsx
@@ -43,10 +43,10 @@ export default function MentionItem({
<div className="truncate">
<span className="font-medium">{name}</span>
{description != null && description ? (
- <span className="text-text-tertiary ml-2 text-sm font-light">{description}</span>
+ <span className="text-text-tertiary ms-2 text-sm font-light">{description}</span>
) : null}
</div>
- <Clock4 size={16} className="ml-2 shrink-0" />
+ <Clock4 size={16} className="ms-2 shrink-0" />
</div>
</div>
</button>
diff --git a/client/src/components/Chat/Input/PopoverButtons.tsx b/client/src/components/Chat/Input/PopoverButtons.tsx
index e2e4677565..691ae63336 100644
--- a/client/src/components/Chat/Input/PopoverButtons.tsx
+++ b/client/src/components/Chat/Input/PopoverButtons.tsx
@@ -54,7 +54,7 @@ export default function PopoverButtons({
label: localize(showExamples === true ? 'com_hide_examples' : 'com_show_examples'),
buttonClass: isGenerativeModel === true || isTextModel ? 'disabled' : '',
handler: triggerExamples,
- icon: <MessagesSquared className={cn('mr-1 w-[0.875rem]', iconClass)} />,
+ icon: <MessagesSquared className={cn('me-1 w-[0.875rem]', iconClass)} />,
},
],
};
@@ -79,7 +79,7 @@ export default function PopoverButtons({
className={cn(
button.buttonClass,
'border-border-medium focus:ring-ring-primary border focus:ring-1',
- 'text-text-primary hover:bg-surface-hover ml-1 h-full bg-transparent px-2 py-1 text-xs font-normal',
+ 'text-text-primary hover:bg-surface-hover ms-1 h-full bg-transparent px-2 py-1 text-xs font-normal',
buttonClass ?? '',
)}
onClick={button.handler}
diff --git a/client/src/components/Chat/Input/Reasoning.tsx b/client/src/components/Chat/Input/Reasoning.tsx
index d98cca286a..0427b43178 100644
--- a/client/src/components/Chat/Input/Reasoning.tsx
+++ b/client/src/components/Chat/Input/Reasoning.tsx
@@ -148,7 +148,7 @@ export function ReasoningControl({
variant="ghost"
size="icon-xs"
aria-label={localize('com_ui_close')}
- className="group -mr-1 shrink-0"
+ className="group -me-1 shrink-0"
>
<X
className="text-text-secondary group-hover:text-text-primary size-4"
@@ -176,7 +176,7 @@ export function ReasoningControl({
<span className="truncate">
{translated(setting.enumMappings?.[options[0]] ?? options[0], localize)}
</span>
- <span className="truncate text-right">
+ <span className="truncate text-end">
{translated(
setting.enumMappings?.[options[options.length - 1]] ??
options[options.length - 1],
@@ -200,7 +200,7 @@ export function ReasoningControl({
step={range.step ?? 1}
onChange={(event) => setNumericValue(event.target.value)}
onBlur={commitNumericValue}
- className="h-8 w-24 text-right"
+ className="h-8 w-24 text-end"
/>
</div>
<span className="text-text-secondary truncate text-xs">
diff --git a/client/src/components/Chat/Input/TokenUsage/Breakdown.spec.tsx b/client/src/components/Chat/Input/TokenUsage/Breakdown.spec.tsx
index 7d6e48e5e5..07c28334c8 100644
--- a/client/src/components/Chat/Input/TokenUsage/Breakdown.spec.tsx
+++ b/client/src/components/Chat/Input/TokenUsage/Breakdown.spec.tsx
@@ -297,7 +297,7 @@ describe('TokenUsage Breakdown', () => {
const estimate = screen.getByTestId('context-estimate');
const peerTotal = Array.from(estimate.children)
- .filter((child) => !child.className.includes('pl-6'))
+ .filter((child) => !child.className.includes('ps-6'))
.reduce((sum, child) => sum + Number(child.lastElementChild?.textContent ?? 0), 0);
/** 300 input + 200 output + 100 estimated = 600 used. The tool share is a
@@ -307,7 +307,7 @@ describe('TokenUsage Breakdown', () => {
const toolRow = within(estimate).getByText('com_ui_context_tool_calls').parentElement
?.parentElement as HTMLElement;
- expect(toolRow.parentElement?.className).toContain('pl-6');
+ expect(toolRow.parentElement?.className).toContain('ps-6');
expect(toolRow.textContent).toContain('150');
});
it('splits tool-call usage out of the messages row when reported', async () => {
@@ -346,7 +346,7 @@ describe('TokenUsage Breakdown', () => {
const peerTotal = Array.from(breakdown.children)
.filter(
(child) =>
- !child.className.includes('pl-6') &&
+ !child.className.includes('ps-6') &&
!child.textContent?.includes('com_ui_context_free'),
)
.reduce(
@@ -455,14 +455,14 @@ describe('TokenUsage Breakdown', () => {
* prompt would show its tokens twice and the visible rows would sum past
* the meter. */
expect(within(breakdown).getByText('com_ui_context_cache_last_call')).toBeInTheDocument();
- expect(cachedRow.parentElement?.className).toContain('pl-6');
+ expect(cachedRow.parentElement?.className).toContain('ps-6');
expect(cachedRow.textContent).toContain('30');
/** The share column is keyed to the window, like every row above: without
* it the cached row reads as a bare number beside rows that all carry a
* percentage, with the cell left blank. */
expect(cachedRow.textContent).toContain('(2%)');
const peers = Array.from(breakdown.children).filter(
- (child) => !child.className.includes('pl-6'),
+ (child) => !child.className.includes('ps-6'),
);
expect(peers.some((peer) => peer.textContent?.includes('com_ui_context_cache_write'))).toBe(
false,
diff --git a/client/src/components/Chat/Input/TokenUsage/Breakdown.tsx b/client/src/components/Chat/Input/TokenUsage/Breakdown.tsx
index 68c61bc9c2..2852198dc0 100644
--- a/client/src/components/Chat/Input/TokenUsage/Breakdown.tsx
+++ b/client/src/components/Chat/Input/TokenUsage/Breakdown.tsx
@@ -67,7 +67,7 @@ function Row({
<span className="text-text-primary shrink-0 font-medium whitespace-nowrap">
{formatTokens(safeValue)}
{percent != null && (
- <span className="text-text-secondary ml-1 text-xs" aria-hidden="true">
+ <span className="text-text-secondary ms-1 text-xs" aria-hidden="true">
({Math.round(percent)}%)
</span>
)}
@@ -75,7 +75,7 @@ function Row({
</>
);
const className = cn(
- 'flex w-full items-center justify-between gap-4 text-left text-sm',
+ 'flex w-full items-center justify-between gap-4 text-start text-sm',
onClick != null &&
'rounded-sm focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-text-primary',
);
@@ -359,7 +359,7 @@ export default function Breakdown({
className="group focus-visible:ring-text-primary flex w-full flex-wrap items-center justify-between gap-2 rounded-sm focus-visible:ring-2"
data-testid="context-breakdown-toggle"
>
- <span className="text-text-primary min-w-0 text-left text-sm font-medium">
+ <span className="text-text-primary min-w-0 text-start text-sm font-medium">
{localize('com_ui_context_window')}
</span>
<span className="text-text-secondary flex min-w-0 items-center gap-1 text-xs font-medium">
@@ -490,7 +490,7 @@ export default function Breakdown({
/>
)}
{id === 'tool-calls' && toolsExpanded && hasToolCounts && (
- <div id={toolBreakdownId} className="space-y-1 pl-6">
+ <div id={toolBreakdownId} className="space-y-1 ps-6">
<p className="text-text-tertiary text-xs font-medium">
{localize('com_ui_context_tool_breakdown')}
</p>
@@ -500,7 +500,7 @@ export default function Breakdown({
</div>
)}
{id === 'system' && dynamicInstructionTokens > 0 && (
- <div className="pl-6">
+ <div className="ps-6">
<Row
label={localize('com_ui_context_dynamic_instructions')}
value={dynamicInstructionTokens}
@@ -517,7 +517,7 @@ export default function Breakdown({
* tokens twice and the visible rows would sum past the meter. */}
{(normalizeTokenCount(view.cacheRead) > 0 ||
normalizeTokenCount(view.cacheWrite) > 0) && (
- <div className="space-y-1.5 pl-6">
+ <div className="space-y-1.5 ps-6">
<p className="text-text-tertiary text-xs font-medium">
{localize('com_ui_context_cache_last_call')}
</p>
@@ -588,7 +588,7 @@ export default function Breakdown({
* rows are provider counts and this share is a char estimate, so
* subtracting it would corrupt them. */}
{normalizeTokenCount(view.toolCallTokens) > 0 && (
- <div className="pl-6">
+ <div className="ps-6">
<Row
label={localize('com_ui_context_tool_calls')}
value={normalizeTokenCount(view.toolCallTokens)}
diff --git a/client/src/components/Chat/Input/TokenUsage/Usage.tsx b/client/src/components/Chat/Input/TokenUsage/Usage.tsx
index bd8ecf0d46..ff5abfe67c 100644
--- a/client/src/components/Chat/Input/TokenUsage/Usage.tsx
+++ b/client/src/components/Chat/Input/TokenUsage/Usage.tsx
@@ -80,7 +80,7 @@ export default function Usage({
<h3 aria-labelledby={headingId}>
<CollapsibleTrigger
disabled={usage == null}
- className="group flex w-full items-start justify-between text-left"
+ className="group flex w-full items-start justify-between text-start"
>
<span className="min-w-0">
<span
@@ -93,7 +93,7 @@ export default function Usage({
<span className="text-text-secondary block text-xs">{subtitle}</span>
)}
</span>
- <span className="ml-3 flex shrink-0 items-center gap-2">
+ <span className="ms-3 flex shrink-0 items-center gap-2">
{cost != null && Number.isFinite(cost) && (
<span
className="text-text-primary text-sm font-medium tabular-nums"
diff --git a/client/src/components/Chat/Messages/Content/ActivityPhaseGroup.tsx b/client/src/components/Chat/Messages/Content/ActivityPhaseGroup.tsx
index 37efc9d47a..0ad5b67290 100644
--- a/client/src/components/Chat/Messages/Content/ActivityPhaseGroup.tsx
+++ b/client/src/components/Chat/Messages/Content/ActivityPhaseGroup.tsx
@@ -185,7 +185,7 @@ const PhaseLabel = memo(function PhaseLabel({
return (
<span
className={cn(
- 'tool-status-text relative block min-w-0 overflow-hidden text-left',
+ 'tool-status-text relative block min-w-0 overflow-hidden text-start',
grow && 'flex-1',
)}
title={text}
@@ -436,7 +436,7 @@ function LivePhaseHeader({
{failedNote !== '' && <span className="sr-only">· {failedNote}</span>}
{cancelledNote !== '' && (
<>
- <span className="text-text-secondary mr-1">·</span>
+ <span className="text-text-secondary me-1">·</span>
<span>{cancelledNote}</span>
</>
)}
@@ -503,7 +503,7 @@ function FailedPeek({
type="button"
className={cn(
TOOL_ROW_CLASSES,
- 'text-text-secondary hover:text-text-primary focus-visible:ring-focus-subtle w-full pl-6 text-left focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-inset',
+ 'text-text-secondary hover:text-text-primary focus-visible:ring-focus-subtle w-full ps-6 text-start focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-inset',
)}
onClick={onReveal}
data-testid="activity-phase-failed-peek"
@@ -530,7 +530,7 @@ function FailedPeek({
{localize('com_ui_plus_n_more', { 0: String(count - 1) })}
</span>
)}
- <span className="ml-auto shrink-0 text-xs font-medium underline underline-offset-2">
+ <span className="ms-auto shrink-0 text-xs font-medium underline underline-offset-2">
{localize('com_ui_show_error')}
</span>
</button>
@@ -801,7 +801,7 @@ export default function ActivityPhaseGroup({
>
<PhaseGlyph failed={allFailed} partial={partialMarkerFallback} />
<span
- className="tool-status-text min-w-0 flex-1 truncate text-left font-medium"
+ className="tool-status-text min-w-0 flex-1 truncate text-start font-medium"
role="status"
title={label}
>
@@ -840,7 +840,7 @@ export default function ActivityPhaseGroup({
* supplies it today; stating it here keeps the requirement with
* the element that depends on it. */
className={cn(
- 'text-text-secondary hover:text-text-primary focus-visible:ring-focus-subtle flex h-auto min-h-7 min-w-0 flex-1 items-center justify-start gap-2 rounded-none bg-transparent p-0 py-1 text-left font-medium hover:bg-transparent focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:outline-none focus-visible:ring-inset',
+ 'text-text-secondary hover:text-text-primary focus-visible:ring-focus-subtle flex h-auto min-h-7 min-w-0 flex-1 items-center justify-start gap-2 rounded-none bg-transparent p-0 py-1 text-start font-medium hover:bg-transparent focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:outline-none focus-visible:ring-inset',
/** The open card's title: the one semibold, primary-colour line
* in the fold, so the rows under it read as its contents. */
isExpanded && 'text-text-primary font-semibold',
diff --git a/client/src/components/Chat/Messages/Content/AgentHandoff.tsx b/client/src/components/Chat/Messages/Content/AgentHandoff.tsx
index 616a2ffa09..704dd32550 100644
--- a/client/src/components/Chat/Messages/Content/AgentHandoff.tsx
+++ b/client/src/components/Chat/Messages/Content/AgentHandoff.tsx
@@ -206,7 +206,7 @@ const AgentHandoff: React.FC<AgentHandoffProps> = ({ name, args: _args = '' }) =
aria-labelledby={headingId}
className={cn(
toolPanelSpacingClassName,
- 'group/handoff border-border-medium ml-8 max-w-3xl border-l-2 py-1 pr-1 pl-4',
+ 'group/handoff border-border-medium ms-8 max-w-3xl border-s-2 py-1 ps-4 pe-1',
)}
>
<div className="mb-1.5 flex min-h-5 items-center justify-between gap-2">
diff --git a/client/src/components/Chat/Messages/Content/AskUserQuestion.tsx b/client/src/components/Chat/Messages/Content/AskUserQuestion.tsx
index c645a6bcd6..15dc9b8477 100644
--- a/client/src/components/Chat/Messages/Content/AskUserQuestion.tsx
+++ b/client/src/components/Chat/Messages/Content/AskUserQuestion.tsx
@@ -368,14 +368,14 @@ function AskUserQuestionSingle({
</Button>
{(status === 'expired' || status === 'error') && (
<span className="text-text-warning flex min-w-0 items-center text-xs">
- <TriangleAlert className="mr-1.5 size-4 shrink-0" aria-hidden="true" />
+ <TriangleAlert className="me-1.5 size-4 shrink-0" aria-hidden="true" />
{localize(status === 'expired' ? 'com_ui_approval_expired' : 'com_ui_approval_error')}
</span>
)}
<Button
size="sm"
variant="submit"
- className="ml-auto"
+ className="ms-auto"
disabled={!canSubmit || locked}
onClick={submitCombined}
>
diff --git a/client/src/components/Chat/Messages/Content/AskUserQuestionCall.tsx b/client/src/components/Chat/Messages/Content/AskUserQuestionCall.tsx
index bc26250e75..3f948d3996 100644
--- a/client/src/components/Chat/Messages/Content/AskUserQuestionCall.tsx
+++ b/client/src/components/Chat/Messages/Content/AskUserQuestionCall.tsx
@@ -247,7 +247,7 @@ function QuestionBody({
</p>
)}
{typeof answer === 'string' && (
- <div className="border-border-medium mt-2.5 border-l-2 pl-3">
+ <div className="border-border-medium mt-2.5 border-s-2 ps-3">
<p className="text-text-secondary text-xs font-medium">
{localize('com_ui_you_answered')}
</p>
diff --git a/client/src/components/Chat/Messages/Content/AskUserQuestions.tsx b/client/src/components/Chat/Messages/Content/AskUserQuestions.tsx
index 5eb2f3ac3b..3a542d754c 100644
--- a/client/src/components/Chat/Messages/Content/AskUserQuestions.tsx
+++ b/client/src/components/Chat/Messages/Content/AskUserQuestions.tsx
@@ -378,7 +378,7 @@ export default function AskUserQuestions({
{showRemaining && (
<button
type="button"
- className="text-text-secondary hover:text-text-primary pt-2 text-left text-xs select-none hover:underline"
+ className="text-text-secondary hover:text-text-primary pt-2 text-start text-xs select-none hover:underline"
onClick={() => goToStep(firstUnanswered)}
>
{localize(
diff --git a/client/src/components/Chat/Messages/Content/CodeAnalyze.tsx b/client/src/components/Chat/Messages/Content/CodeAnalyze.tsx
index 750dd9fc38..0aa8f91f39 100644
--- a/client/src/components/Chat/Messages/Content/CodeAnalyze.tsx
+++ b/client/src/components/Chat/Messages/Content/CodeAnalyze.tsx
@@ -74,7 +74,9 @@ export default function CodeAnalyze({
<div className="bg-surface-tertiary p-4 text-xs">
<div className="text-text-secondary mb-1">{localize('com_ui_result')}</div>
<div className="prose flex flex-col-reverse">
- <pre className="text-text-primary! shrink-0">{logs}</pre>
+ <pre dir="ltr" className="text-text-primary! shrink-0">
+ {logs}
+ </pre>
</div>
</div>
)}
diff --git a/client/src/components/Chat/Messages/Content/DialogImage.tsx b/client/src/components/Chat/Messages/Content/DialogImage.tsx
index f4f32a3bdc..4dd98b0d8f 100644
--- a/client/src/components/Chat/Messages/Content/DialogImage.tsx
+++ b/client/src/components/Chat/Messages/Content/DialogImage.tsx
@@ -283,7 +283,7 @@ export default function DialogImage({
<DialogPrimitive.Title className="sr-only">{title}</DialogPrimitive.Title>
)}
{/* Close button - top left */}
- <div className="absolute top-4 left-4 z-20">
+ <div className="absolute inset-s-4 top-4 z-20">
<TooltipAnchor
zIndex={TOOLTIP_Z_INDEX}
description={localize('com_ui_close')}
@@ -304,7 +304,7 @@ export default function DialogImage({
{/* Action buttons - top right (21rem = 20rem panel + 1rem gap) */}
<div
- className={`absolute top-4 z-20 flex items-center gap-2 transition-[right] duration-300 ${detailsBeside ? 'right-[21rem]' : 'right-4'}`}
+ className={`absolute top-4 z-20 flex items-center gap-2 transition-all duration-300 ${detailsBeside ? 'inset-e-[21rem]' : 'inset-e-4'}`}
>
{zoom > 1 && (
<TooltipAnchor
@@ -362,7 +362,7 @@ export default function DialogImage({
{/* Image container - centered */}
<div
- className={`transition-[margin] duration-300 ${detailsBeside ? 'mr-80' : ''}`}
+ className={`transition-[margin] duration-300 ${detailsBeside ? 'me-80' : ''}`}
onClick={(e) => e.stopPropagation()}
>
<div
@@ -402,8 +402,8 @@ export default function DialogImage({
{showDetails && (
<div
data-side-panel
- className={`bg-surface-primary border-text-on-media/10 fixed top-0 right-0 z-30 h-full w-80 max-w-full transform border-l shadow-2xl transition-transform duration-300 ${
- isPromptOpen ? 'translate-x-0' : 'translate-x-full'
+ className={`bg-surface-primary border-text-on-media/10 fixed inset-e-0 top-0 z-30 h-full w-80 max-w-full transform border-s shadow-2xl transition-transform duration-300 ${
+ isPromptOpen ? 'translate-x-0' : 'translate-x-full rtl:-translate-x-full'
}`}
onClick={(e) => e.stopPropagation()}
>
diff --git a/client/src/components/Chat/Messages/Content/FilePreviewDialog.tsx b/client/src/components/Chat/Messages/Content/FilePreviewDialog.tsx
index 43adc4e616..28d2431136 100644
--- a/client/src/components/Chat/Messages/Content/FilePreviewDialog.tsx
+++ b/client/src/components/Chat/Messages/Content/FilePreviewDialog.tsx
@@ -266,7 +266,7 @@ export default function FilePreviewDialog({
className="flex w-full max-w-4xl flex-col !overflow-hidden p-0"
showCloseButton={true}
>
- <div className="shrink-0 px-6 pt-6 pr-12">
+ <div className="shrink-0 px-6 pe-12 pt-6">
<OGDialogTitle className="truncate text-base">{fileName}</OGDialogTitle>
<div className="mt-0.5 flex items-center gap-3">
<OGDialogDescription className="min-w-0 truncate">
@@ -321,7 +321,7 @@ export default function FilePreviewDialog({
)}
{displayedText !== null && !isLoading && !hasPreviewError && (
<>
- <div className="pointer-events-none sticky top-0 z-10 flex justify-end pr-1">
+ <div className="pointer-events-none sticky top-0 z-10 flex justify-end pe-1">
<CopyButton
isCopied={isCopied}
onClick={handleCopy}
@@ -331,7 +331,7 @@ export default function FilePreviewDialog({
/>
</div>
<div className="bg-surface-secondary -mt-8 rounded-lg p-4">
- <pre className="text-text-primary pr-8 font-mono text-sm leading-6 break-words whitespace-pre-wrap">
+ <pre className="text-text-primary pe-8 font-mono text-sm leading-6 break-words whitespace-pre-wrap">
{displayedText}
</pre>
</div>
diff --git a/client/src/components/Chat/Messages/Content/Image.tsx b/client/src/components/Chat/Messages/Content/Image.tsx
index b6c99f057b..f12c95d4be 100644
--- a/client/src/components/Chat/Messages/Content/Image.tsx
+++ b/client/src/components/Chat/Messages/Content/Image.tsx
@@ -96,7 +96,7 @@ const Image = ({
const showSkeleton = hasDimensions && !paintedUrls.has(absoluteImageUrl);
return (
- <div className={alignRight ? 'ml-auto' : undefined}>
+ <div className={alignRight ? 'ms-auto' : undefined}>
<button
ref={triggerRef}
type="button"
diff --git a/client/src/components/Chat/Messages/Content/MarkdownComponents.tsx b/client/src/components/Chat/Messages/Content/MarkdownComponents.tsx
index 9cfe33920c..b63c5997e3 100644
--- a/client/src/components/Chat/Messages/Content/MarkdownComponents.tsx
+++ b/client/src/components/Chat/Messages/Content/MarkdownComponents.tsx
@@ -1,5 +1,6 @@
import React, { memo, useMemo, useRef, useEffect } from 'react';
import { PermissionTypes, Permissions, apiBaseUrl } from 'librechat-data-provider';
+import type { Element, ElementContent } from 'hast';
import {
handleDoubleClick,
triggerDownload,
@@ -11,6 +12,7 @@ import { useMessagePartsHost } from '~/Providers/MessagePartsHostContext';
import { useCodeBlockContext, useMediaContext } from '~/Providers';
import CodeBlock from '~/components/Messages/Content/CodeBlock';
import useHasAccess from '~/hooks/Roles/useHasAccess';
+import { strongDirection } from '~/utils/direction';
import { useFileDownload } from '~/data-provider';
import { useLocalize } from '~/hooks';
@@ -189,17 +191,86 @@ type TParagraphProps = {
};
export const p: React.ElementType = memo(function MarkdownParagraph({ children }: TParagraphProps) {
- return <p className="mb-2 whitespace-pre-wrap">{children}</p>;
+ return (
+ <p dir="auto" className="mb-2 whitespace-pre-wrap">
+ {children}
+ </p>
+ );
});
p.displayName = 'MarkdownParagraph';
+type TBlockProps = React.HTMLAttributes<HTMLElement> & { node?: Element };
+
+/** Resolves direction per block so a mixed-language reply is not laid out by its first character. */
+const withAutoDir = (Tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6') => {
+ const Block: React.ElementType = memo(function MarkdownBlock({
+ node: _node,
+ ...props
+ }: TBlockProps) {
+ return <Tag dir="auto" {...props} />;
+ });
+ Block.displayName = `Markdown${Tag.toUpperCase()}`;
+ return Block;
+};
+
+/** First strong direction of a subtree's text, skipping code, which is always left-to-right. */
+const nodeDirection = (node: Element | ElementContent): 'ltr' | 'rtl' | null => {
+ if (node.type === 'text') {
+ return strongDirection(node.value);
+ }
+ if (node.type !== 'element' || node.tagName === 'code' || node.tagName === 'pre') {
+ return null;
+ }
+ for (const child of node.children) {
+ const direction = nodeDirection(child);
+ if (direction != null) {
+ return direction;
+ }
+ }
+ return null;
+};
+
+/**
+ * Quotes and lists hold paragraphs that carry their own `dir="auto"`, and the browser's
+ * `dir="auto"` skips those, so a container would resolve to LTR whatever its text. Resolve it
+ * from the subtree instead, and inherit when there is no strong character. A list takes one
+ * direction so its markers and indent stay on the same side.
+ */
+const withContentDir = (Tag: 'ul' | 'ol' | 'blockquote') => {
+ const Block: React.ElementType = memo(function MarkdownContainer({
+ node,
+ ...props
+ }: TBlockProps) {
+ const dir = node != null ? (nodeDirection(node) ?? undefined) : undefined;
+ return <Tag dir={dir} {...props} />;
+ });
+ Block.displayName = `Markdown${Tag.toUpperCase()}`;
+ return Block;
+};
+
+export const ul = withContentDir('ul');
+export const ol = withContentDir('ol');
+export const h1 = withAutoDir('h1');
+export const h2 = withAutoDir('h2');
+export const h3 = withAutoDir('h3');
+export const h4 = withAutoDir('h4');
+export const h5 = withAutoDir('h5');
+export const h6 = withAutoDir('h6');
+export const blockquote = withContentDir('blockquote');
+
type TTableProps = {
children: React.ReactNode;
+ node?: Element;
};
-export const table: React.ElementType = memo(function MarkdownTable({ children }: TTableProps) {
+/** One direction for the whole table, so cell borders and corners stay on a single frame. */
+export const table: React.ElementType = memo(function MarkdownTable({
+ children,
+ node,
+}: TTableProps) {
+ const dir = node != null ? (nodeDirection(node) ?? undefined) : undefined;
return (
- <div className="markdown-table-wrapper w-full max-w-full">
+ <div dir={dir} className="markdown-table-wrapper w-full max-w-full">
<table>{children}</table>
</div>
);
diff --git a/client/src/components/Chat/Messages/Content/MarkdownErrorBoundary.tsx b/client/src/components/Chat/Messages/Content/MarkdownErrorBoundary.tsx
index d3e6f8bf17..3d65a2ae14 100644
--- a/client/src/components/Chat/Messages/Content/MarkdownErrorBoundary.tsx
+++ b/client/src/components/Chat/Messages/Content/MarkdownErrorBoundary.tsx
@@ -4,7 +4,23 @@ import supersub from 'remark-supersub';
import ReactMarkdown from 'react-markdown';
import rehypeHighlight from 'rehype-highlight';
import type { PluggableList } from 'unified';
-import { code, codeNoExecution, a, p, img, table } from './MarkdownComponents';
+import {
+ code,
+ codeNoExecution,
+ a,
+ p,
+ img,
+ table,
+ ul,
+ ol,
+ h1,
+ h2,
+ h3,
+ h4,
+ h5,
+ h6,
+ blockquote,
+} from './MarkdownComponents';
import { langSubset, remarkApproxTilde } from '~/utils';
import { reportBoundaryError } from '~/lib/rum/logs';
import { CodeBlockProvider } from '~/Providers';
@@ -80,6 +96,15 @@ class MarkdownErrorBoundary extends React.Component<
* `![chart](chart.png)` to a page-relative URL. */
img,
table,
+ ul,
+ ol,
+ h1,
+ h2,
+ h3,
+ h4,
+ h5,
+ h6,
+ blockquote,
} as {
[nodeType: string]: React.ElementType;
}
diff --git a/client/src/components/Chat/Messages/Content/MarkdownLite.tsx b/client/src/components/Chat/Messages/Content/MarkdownLite.tsx
index b9d70480d8..54bd0eab31 100644
--- a/client/src/components/Chat/Messages/Content/MarkdownLite.tsx
+++ b/client/src/components/Chat/Messages/Content/MarkdownLite.tsx
@@ -6,7 +6,23 @@ import supersub from 'remark-supersub';
import ReactMarkdown from 'react-markdown';
import rehypeHighlight from 'rehype-highlight';
import type { PluggableList } from 'unified';
-import { code, codeNoExecution, a, p, img, table } from './MarkdownComponents';
+import {
+ code,
+ codeNoExecution,
+ a,
+ p,
+ img,
+ table,
+ ul,
+ ol,
+ h1,
+ h2,
+ h3,
+ h4,
+ h5,
+ h6,
+ blockquote,
+} from './MarkdownComponents';
import { CodeBlockProvider, ArtifactProvider } from '~/Providers';
import MarkdownErrorBoundary from './MarkdownErrorBoundary';
import { langSubset, remarkApproxTilde } from '~/utils';
@@ -46,6 +62,15 @@ const MarkdownLite = memo(
p,
img,
table,
+ ul,
+ ol,
+ h1,
+ h2,
+ h3,
+ h4,
+ h5,
+ h6,
+ blockquote,
} as {
[nodeType: string]: React.ElementType;
}
diff --git a/client/src/components/Chat/Messages/Content/Part.tsx b/client/src/components/Chat/Messages/Content/Part.tsx
index 10536892e7..52c17b69d6 100644
--- a/client/src/components/Chat/Messages/Content/Part.tsx
+++ b/client/src/components/Chat/Messages/Content/Part.tsx
@@ -681,7 +681,7 @@ const renderers: PartRenderers = {
const failed = part.status === 'failed' || part.status === 'partial';
return (
<div
- className={`my-1 pl-1 text-sm break-words italic ${failed ? 'text-text-warning' : 'text-text-secondary'}`}
+ className={`my-1 ps-1 text-sm break-words italic ${failed ? 'text-text-warning' : 'text-text-secondary'}`}
>
{display}
</div>
diff --git a/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx b/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx
index ec4a1246f8..f2aa369fa7 100644
--- a/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx
@@ -235,7 +235,7 @@ const FileAttachmentGroup = memo(({ attachments }: { attachments: TAttachment[]
aria-label={buttonLabel}
onClick={() => setIsExpanded((prev) => !prev)}
className={cn(
- 'inline-flex w-full max-w-full items-center gap-2 rounded-lg py-1 pr-2 text-sm',
+ 'inline-flex w-full max-w-full items-center gap-2 rounded-lg py-1 pe-2 text-sm',
'text-text-secondary hover:text-text-primary transition-colors',
'focus-visible:ring-focus-subtle focus-visible:ring-2 focus-visible:outline-hidden',
)}
@@ -243,14 +243,14 @@ const FileAttachmentGroup = memo(({ attachments }: { attachments: TAttachment[]
<FilesIcon className="size-4 shrink-0" aria-hidden="true" />
<span className="shrink-0 font-medium">{fileCount}</span>
{summary.length > 0 && (
- <span className="min-w-0 truncate text-left text-xs font-normal" title={summary}>
+ <span className="min-w-0 truncate text-start text-xs font-normal" title={summary}>
{'— '}
{summary}
</span>
)}
<ChevronDown
className={cn(
- 'ml-auto size-4 shrink-0 transition-transform duration-200 ease-out',
+ 'ms-auto size-4 shrink-0 transition-transform duration-200 ease-out',
isExpanded && 'rotate-180',
)}
aria-hidden="true"
diff --git a/client/src/components/Chat/Messages/Content/Parts/BackgroundTaskCall.tsx b/client/src/components/Chat/Messages/Content/Parts/BackgroundTaskCall.tsx
index 80343b1cb6..79da313216 100644
--- a/client/src/components/Chat/Messages/Content/Parts/BackgroundTaskCall.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/BackgroundTaskCall.tsx
@@ -167,7 +167,7 @@ export default function BackgroundTaskCall({
<ul
tabIndex={0}
aria-label={localize('com_ui_background_tasks')}
- className="focus-visible:ring-focus-subtle flex max-h-96 flex-col gap-2 overflow-y-auto pr-1 focus-visible:ring-2 focus-visible:outline-none"
+ className="focus-visible:ring-focus-subtle flex max-h-96 flex-col gap-2 overflow-y-auto pe-1 focus-visible:ring-2 focus-visible:outline-none"
>
{display.tasks.map((task) => (
<li key={task.taskId}>
diff --git a/client/src/components/Chat/Messages/Content/Parts/BashCall.tsx b/client/src/components/Chat/Messages/Content/Parts/BashCall.tsx
index 08d722669b..66c78cf043 100644
--- a/client/src/components/Chat/Messages/Content/Parts/BashCall.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/BashCall.tsx
@@ -245,7 +245,10 @@ export default function BashCall({
isCopied={isCopied}
onClick={handleCopy}
disabled={contentPending}
- className={cn('bg-surface-code absolute top-1 right-1.5 z-[1]', PANE_COPY_REVEAL)}
+ className={cn(
+ 'bg-surface-code absolute inset-e-1.5 top-1 z-[1]',
+ PANE_COPY_REVEAL,
+ )}
label={localize('com_ui_copy_code')}
/>
<div
@@ -253,7 +256,10 @@ export default function BashCall({
onScroll={onCommandPaneScroll}
className="max-h-[18.75rem] overflow-auto"
>
- <pre className="px-3 py-2.5 font-mono text-xs break-words whitespace-pre-wrap">
+ <pre
+ dir="ltr"
+ className="px-3 py-2.5 font-mono text-xs break-words whitespace-pre-wrap"
+ >
<span className="text-text-tertiary select-none" aria-hidden="true">
{'$ '}
</span>
diff --git a/client/src/components/Chat/Messages/Content/Parts/CodeWindowHeader.tsx b/client/src/components/Chat/Messages/Content/Parts/CodeWindowHeader.tsx
index 7917c1f987..0a89a2a68c 100644
--- a/client/src/components/Chat/Messages/Content/Parts/CodeWindowHeader.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/CodeWindowHeader.tsx
@@ -31,7 +31,7 @@ export default function CodeWindowHeader({ language, code, diffStats }: CodeWind
return (
<div className="text-text-secondary flex items-center justify-between px-1.5 py-1.5 font-sans text-xs">
- <span className="flex items-center gap-1.5 pl-1.5 text-xs font-medium">
+ <span className="flex items-center gap-1.5 ps-1.5 text-xs font-medium">
<LangIcon lang={language} className="size-3.5 shrink-0" />
{language}
{diffStats && (
diff --git a/client/src/components/Chat/Messages/Content/Parts/DiffView.tsx b/client/src/components/Chat/Messages/Content/Parts/DiffView.tsx
index 2872de5ac3..e7b6afc162 100644
--- a/client/src/components/Chat/Messages/Content/Parts/DiffView.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/DiffView.tsx
@@ -185,7 +185,7 @@ const DiffRow = memo(function DiffRow({ type, text, num, hasLineNumbers }: DiffR
)}
>
{hasLineNumbers && (
- <span className="text-text-tertiary text-2xs w-9 shrink-0 pr-1 text-right select-none">
+ <span className="text-text-tertiary text-2xs w-9 shrink-0 pe-1 text-end select-none">
{num ?? ''}
</span>
)}
@@ -199,7 +199,7 @@ const DiffRow = memo(function DiffRow({ type, text, num, hasLineNumbers }: DiffR
>
{LINE_MARKERS[type]}
</span>
- <span className="text-text-primary min-w-0 flex-1 pr-3 break-words whitespace-pre-wrap">
+ <span className="text-text-primary min-w-0 flex-1 pe-3 break-words whitespace-pre-wrap">
{text || ' '}
</span>
</div>
@@ -216,6 +216,7 @@ export default function DiffView({ parsed }: { parsed: ParsedDiff }) {
return (
<div
data-testid="diff-view"
+ dir="ltr"
className="bg-surface-code max-h-[300px] overflow-y-auto py-2 font-mono text-xs leading-5"
>
{lines.map((line, index) => {
diff --git a/client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx b/client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx
index 081cdad0d3..46ce53bf6d 100644
--- a/client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx
@@ -197,6 +197,7 @@ export default function ExecuteCode({
{code && <CodeWindowHeader language={lang} code={code} />}
{code && (
<pre
+ dir="ltr"
ref={codePaneRef}
onScroll={onCodePaneScroll}
className="bg-surface-code-body max-h-[18.75rem] overflow-auto p-4 font-mono text-xs"
diff --git a/client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx b/client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx
index 6cbbf7dde3..b7e7fca115 100644
--- a/client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx
@@ -256,6 +256,7 @@ export default function FileAuthoringCall({
<DiffView parsed={parsedDiff} />
) : (
<pre
+ dir="ltr"
ref={previewPaneRef}
onScroll={onPreviewPaneScroll}
className="bg-surface-code-body max-h-[18.75rem] overflow-auto p-4 font-mono text-xs"
@@ -267,6 +268,7 @@ export default function FileAuthoringCall({
)}
{showOutputSection && (
<pre
+ dir="ltr"
className={cn(
'border-border-inset max-h-[18.75rem] overflow-auto border-t px-3 py-2 font-mono text-xs break-words whitespace-pre-wrap',
phase === 'failed' ? 'text-status-error' : 'text-text-secondary',
diff --git a/client/src/components/Chat/Messages/Content/Parts/LogContent.tsx b/client/src/components/Chat/Messages/Content/Parts/LogContent.tsx
index 6ef1bd5bc2..d04dc5a720 100644
--- a/client/src/components/Chat/Messages/Content/Parts/LogContent.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/LogContent.tsx
@@ -226,7 +226,10 @@ const LogContent: React.FC<LogContentProps> = ({ output = '', renderImages, atta
)}
</div>
)}
- <pre className="text-text-primary max-h-80 overflow-auto font-mono text-xs leading-5 break-words whitespace-pre-wrap">
+ <pre
+ dir="ltr"
+ className="text-text-primary max-h-80 overflow-auto font-mono text-xs leading-5 break-words whitespace-pre-wrap"
+ >
{file.text}
</pre>
</div>
diff --git a/client/src/components/Chat/Messages/Content/Parts/PtcToolTrace.tsx b/client/src/components/Chat/Messages/Content/Parts/PtcToolTrace.tsx
index c767769a08..8cdb6b2169 100644
--- a/client/src/components/Chat/Messages/Content/Parts/PtcToolTrace.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/PtcToolTrace.tsx
@@ -148,6 +148,7 @@ export default function PtcToolTrace({
<ol
ref={listRef}
onScroll={onScroll}
+ dir="ltr"
className="max-h-[200px] overflow-auto font-mono"
aria-live="polite"
>
diff --git a/client/src/components/Chat/Messages/Content/Parts/ReadFileCall.tsx b/client/src/components/Chat/Messages/Content/Parts/ReadFileCall.tsx
index 1380754c82..393aee57ec 100644
--- a/client/src/components/Chat/Messages/Content/Parts/ReadFileCall.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/ReadFileCall.tsx
@@ -158,7 +158,10 @@ export default function ReadFileCall({
)}
>
<CodeWindowHeader language={fileName} code={output} />
- <pre className="bg-surface-code-body max-h-[18.75rem] overflow-auto p-4 font-mono text-xs">
+ <pre
+ dir="ltr"
+ className="bg-surface-code-body max-h-[18.75rem] overflow-auto p-4 font-mono text-xs"
+ >
<code className={`hljs language-${lang} !whitespace-pre`}>
{highlighted ?? output}
</code>
diff --git a/client/src/components/Chat/Messages/Content/Parts/Stdout.tsx b/client/src/components/Chat/Messages/Content/Parts/Stdout.tsx
index 93b28d8341..68813a22ca 100644
--- a/client/src/components/Chat/Messages/Content/Parts/Stdout.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/Stdout.tsx
@@ -18,7 +18,7 @@ export default function Stdout({ output = '' }: StdoutProps) {
}
return (
- <pre className="shrink-0 whitespace-pre-wrap break-words font-mono text-text-primary">
+ <pre dir="ltr" className="text-text-primary shrink-0 font-mono break-words whitespace-pre-wrap">
{processedContent}
</pre>
);
diff --git a/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx b/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx
index 610dcf1f72..07b963d104 100644
--- a/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx
@@ -122,7 +122,7 @@ const SteerPart = memo(function SteerPart({
>
<div className="user-turn relative flex w-fit max-w-[90%] flex-col items-end sm:max-w-[85%]">
<h2 className="sr-only">{label}</h2>
- <div className="rounded-theme-surface rounded-br-theme-control bg-surface-user-message px-theme-normal flex max-w-full flex-col items-start gap-2 py-2.5">
+ <div className="rounded-theme-surface rounded-ee-theme-control bg-surface-user-message px-theme-normal flex max-w-full flex-col items-start gap-2 py-2.5">
<MessageQuotes quotes={quotes} />
{(imageFiles.length > 0 || otherFiles.length > 0) && (
<div className="flex w-full flex-wrap gap-2">
@@ -134,7 +134,7 @@ const SteerPart = memo(function SteerPart({
/>
))}
{imageFiles.length > 0 && (
- <div className="ml-auto flex max-w-full flex-wrap justify-end gap-2">
+ <div className="ms-auto flex max-w-full flex-wrap justify-end gap-2">
{imageFiles.map((file) => (
<Image
key={file.file_id}
@@ -165,7 +165,7 @@ const SteerPart = memo(function SteerPart({
* park them wherever the hover-revealed time happens to end, and that
* width changes as the relative string ticks. */}
<div className="text-text-secondary mt-1 flex min-h-8 items-center justify-end gap-2">
- <MessageTimestamp value={timestamp} className="ml-0" />
+ <MessageTimestamp value={timestamp} className="ms-0" />
<SteerReceipt state={receiptState} live={isSubmitting} animateIn={animateIn} />
</div>
</div>
diff --git a/client/src/components/Chat/Messages/Content/Parts/SubagentCall.tsx b/client/src/components/Chat/Messages/Content/Parts/SubagentCall.tsx
index e9d42235d3..606df0255e 100644
--- a/client/src/components/Chat/Messages/Content/Parts/SubagentCall.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/SubagentCall.tsx
@@ -22,6 +22,7 @@ import { resolveSubagentAgentId } from '~/components/Chat/Subagents/identity';
import { subagentStatusLabelKey } from '~/components/Chat/Subagents/status';
import { useOpenSubagentPanel } from '~/components/Chat/Subagents/surface';
import { getSubagentPrompt } from '~/components/Chat/Subagents/prompt';
+import { tailOverflowDirection } from '~/utils/subagentContent';
import { MessageContext } from '~/Providers/MessageContext';
import { useShareContext } from '~/Providers/ShareContext';
import MessageIcon from '~/components/Share/MessageIcon';
@@ -435,7 +436,7 @@ export default function SubagentCall({
data-subagent-parent-message={parentMessageId}
data-subagent-part-index={partIndex}
className={cn(
- 'border-border-light bg-surface-secondary my-2 flex w-full flex-col gap-1 rounded-lg border px-3 py-2 text-left transition',
+ 'border-border-light bg-surface-secondary my-2 flex w-full flex-col gap-1 rounded-lg border px-3 py-2 text-start transition',
canOpenDetails ? 'group' : 'cursor-default opacity-80',
running && !detachedStatusUnknown && 'animate-pulse-slow',
)}
@@ -509,13 +510,13 @@ export default function SubagentCall({
{canOpenDetails && (
<ChevronRight
size={14}
- className="text-text-secondary shrink-0 transition group-hover:translate-x-0.5"
+ className="text-text-secondary shrink-0 transition group-hover:translate-x-0.5 rtl:-scale-x-100 rtl:group-hover:-translate-x-0.5"
aria-hidden="true"
/>
)}
</div>
- <ul className="text-text-secondary w-full space-y-0.5 pl-5 font-mono text-xs">
+ <ul className="text-text-secondary w-full space-y-0.5 ps-5 font-mono text-xs">
{displayedTickerLines.length === 0 && running ? (
<li className="truncate opacity-70">{localize('com_ui_subagent_waiting')}</li>
) : null}
@@ -630,28 +631,36 @@ function ToolIdentifier({
/**
* Renderer for one ticker line. Writing is the default visible activity, so
* it renders without a redundant prefix. Reasoning retains its semantic label.
- * Streaming bodies use `dir="rtl"` + `text-align: left` to push tail-side
- * ellipsis behavior (newest characters stay flush-right, oldest clip off the
- * left). The rtl trick is scoped to the body span so trailing punctuation on
- * non-streaming lines can't get flipped by bidi.
+ * Streaming bodies run the outer box opposite to the text direction so the
+ * oldest characters clip and the newest stay visible; `text-end` of that box is
+ * the text's own start, so a line that fits stays where it reads from. The text
+ * sits in an isolated `dir="auto"` span so its punctuation is never reordered.
*
* Tool lines (`using_tool`, `tool_complete`) go through `ToolIdentifier`
* so MCP-hosted tools render as `<server> · <tool>` badges and native
* tools use their friendly names — matching the delimiter-aware
* rendering the main tool UI already uses.
*/
+function TailText({ text }: { text: string }): JSX.Element {
+ return (
+ <span
+ dir={tailOverflowDirection(text)}
+ className="min-w-0 flex-1 overflow-hidden text-end text-ellipsis whitespace-nowrap"
+ >
+ <bdi dir="auto" className="[unicode-bidi:isolate]">
+ {text}
+ </bdi>
+ </span>
+ );
+}
+
function TickerLineView({ line }: { line: SubagentTickerLine }): JSX.Element {
const localize = useLocalize();
const mcpServerNames = useMCPServerNames();
if (line.kind === 'writing') {
return (
<li className="text-text-primary flex w-full items-baseline overflow-hidden">
- <span
- dir="rtl"
- className="min-w-0 flex-1 overflow-hidden text-left text-ellipsis whitespace-nowrap"
- >
- {line.body}
- </span>
+ <TailText text={line.body} />
</li>
);
}
@@ -659,12 +668,7 @@ function TickerLineView({ line }: { line: SubagentTickerLine }): JSX.Element {
return (
<li className="text-text-primary flex w-full items-baseline gap-1 overflow-hidden">
<span className="shrink-0">{localize('com_ui_subagent_ticker_reasoning')}:</span>
- <span
- dir="rtl"
- className="min-w-0 flex-1 overflow-hidden text-left text-ellipsis whitespace-nowrap"
- >
- {line.body}
- </span>
+ <TailText text={line.body} />
</li>
);
}
@@ -696,12 +700,7 @@ function TickerLineView({ line }: { line: SubagentTickerLine }): JSX.Element {
mcpServerNames={mcpServerNames}
/>
<span className="text-text-tertiary shrink-0">→</span>
- <span
- dir="rtl"
- className="min-w-0 flex-1 overflow-hidden text-left text-ellipsis whitespace-nowrap"
- >
- {line.outputSnippet ?? localize('com_ui_subagent_ticker_tool_done')}
- </span>
+ <TailText text={line.outputSnippet ?? localize('com_ui_subagent_ticker_tool_done')} />
</li>
);
}
diff --git a/client/src/components/Chat/Messages/Content/Parts/Thinking.tsx b/client/src/components/Chat/Messages/Content/Parts/Thinking.tsx
index c37aaffff6..6553f190bd 100644
--- a/client/src/components/Chat/Messages/Content/Parts/Thinking.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/Thinking.tsx
@@ -149,9 +149,9 @@ export const ThinkingButton = memo(
* row in the same list as tool calls, grouped thoughts and phase
* summaries, all set at that scale. Sized to the body it read as a
* second, larger kind of row beside them. */
- className="group/button tool-status-text flex flex-1 items-center justify-start rounded-lg pr-10"
+ className="group/button tool-status-text flex flex-1 items-center justify-start rounded-lg pe-10"
>
- <span className={cn(ROW_GLYPH_SLOT, 'relative mr-2')}>
+ <span className={cn(ROW_GLYPH_SLOT, 'relative me-2')}>
<Lightbulb
className="icon-sm text-text-secondary absolute opacity-100 transition-opacity group-hover/button:opacity-0"
aria-hidden="true"
@@ -186,7 +186,7 @@ export const ThinkingButton = memo(
<span
key={animateLabel ? label : undefined}
className={cn(
- 'min-w-0 truncate text-left font-medium',
+ 'min-w-0 truncate text-start font-medium',
shimmerLabel && !animateLabel && 'shimmer',
animateLabel &&
'animate-in fade-in-0 slide-in-from-bottom-1 duration-300 ease-out motion-reduce:animate-none',
@@ -207,7 +207,7 @@ export const ThinkingButton = memo(
label={localize('com_ui_copy_thoughts_to_clipboard')}
copiedLabel={localize('com_ui_copied_to_clipboard')}
className={cn(
- 'absolute top-1/2 right-0 -translate-y-1/2 opacity-0 transition-opacity',
+ 'absolute inset-e-0 top-1/2 -translate-y-1/2 opacity-0 transition-opacity',
'group-focus-within/thinking-container:opacity-100 group-hover/thinking-container:opacity-100',
'focus-visible:opacity-100',
)}
@@ -228,10 +228,10 @@ export const ThinkingLabel = memo(({ label, title }: { label: string; title?: st
return (
<div className="mb-2 pt-2 pb-2">
<div className="tool-status-text flex w-full items-center justify-start" title={title}>
- <span className={cn(ROW_GLYPH_SLOT, 'relative mr-2')}>
+ <span className={cn(ROW_GLYPH_SLOT, 'relative me-2')}>
<Lightbulb className="icon-sm text-text-secondary" aria-hidden="true" />
</span>
- <span className="text-text-secondary min-w-0 truncate text-left font-medium">{label}</span>
+ <span className="text-text-secondary min-w-0 truncate text-start font-medium">{label}</span>
</div>
</div>
);
@@ -276,7 +276,7 @@ export const FloatingThinkingBar = memo(
className={cn(
/* Laid over the text rather than reserved below it, so the box keeps
even padding; the fill keeps the controls legible over a line. */
- 'bg-surface-secondary absolute right-3 bottom-3 flex items-center gap-2 rounded-lg transition-opacity duration-150',
+ 'bg-surface-secondary absolute inset-e-3 bottom-3 flex items-center gap-2 rounded-lg transition-opacity duration-150',
isVisible ? 'opacity-100' : 'pointer-events-none opacity-0',
)}
>
diff --git a/client/src/components/Chat/Messages/Content/Parts/__tests__/PendingSteers.test.tsx b/client/src/components/Chat/Messages/Content/Parts/__tests__/PendingSteers.test.tsx
index bd9471981c..17602688ec 100644
--- a/client/src/components/Chat/Messages/Content/Parts/__tests__/PendingSteers.test.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/__tests__/PendingSteers.test.tsx
@@ -172,7 +172,7 @@ describe('PendingSteers', () => {
const cancel = screen.getByRole('button', { name: 'com_ui_cancel' });
expect(cancel).toBeEnabled();
expect(cancel.parentElement).toHaveClass('flex-wrap', 'justify-end');
- expect(cancel.parentElement).not.toHaveClass('pl-9');
+ expect(cancel.parentElement).not.toHaveClass('ps-9');
});
it('aligns failed-steer recovery actions with the bubble and allows wrapping', () => {
@@ -180,7 +180,7 @@ describe('PendingSteers', () => {
const retry = screen.getByRole('button', { name: 'com_ui_retry' });
expect(retry.parentElement).toHaveClass('flex-wrap', 'justify-end');
- expect(retry.parentElement).not.toHaveClass('pl-9');
+ expect(retry.parentElement).not.toHaveClass('ps-9');
});
it.each(['sending', 'pending', 'failed'] as const)(
diff --git a/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsx b/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsx
index 7b6ef55626..8fc514f11d 100644
--- a/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsx
+++ b/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsx
@@ -199,7 +199,7 @@ describe('SteerPart presentation', () => {
expect(images).toHaveLength(2);
expect(imageGroup).toContainElement(images[1]);
- expect(imageGroup).toHaveClass('ml-auto', 'flex-wrap', 'justify-end');
+ expect(imageGroup).toHaveClass('ms-auto', 'flex-wrap', 'justify-end');
expect(imageGroup?.parentElement).toHaveClass('w-full');
expect(imageGroup).not.toContainElement(screen.getByTestId('steer-file'));
expect(screen.getByTestId('steer-file')).toHaveTextContent('notes.pdf');
diff --git a/client/src/components/Chat/Messages/Content/RetrievalCall.tsx b/client/src/components/Chat/Messages/Content/RetrievalCall.tsx
index ce4ce5a2a4..37fec61f84 100644
--- a/client/src/components/Chat/Messages/Content/RetrievalCall.tsx
+++ b/client/src/components/Chat/Messages/Content/RetrievalCall.tsx
@@ -299,7 +299,7 @@ function FileHeader({
<button
type="button"
onClick={onOpenPreview}
- className="text-text-primary decoration-border-medium hover:text-text-secondary focus-visible:ring-focus-subtle min-w-0 truncate text-left text-xs font-medium underline underline-offset-2 transition-colors focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-hidden"
+ className="text-text-primary decoration-border-medium hover:text-text-secondary focus-visible:ring-focus-subtle min-w-0 truncate text-start text-xs font-medium underline underline-offset-2 transition-colors focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-hidden"
aria-label={`${localize('com_ui_preview')}: ${fileName}`}
>
{fileName}
diff --git a/client/src/components/Chat/Messages/Content/ToolApproval.tsx b/client/src/components/Chat/Messages/Content/ToolApproval.tsx
index 37cc67fe69..afb701808d 100644
--- a/client/src/components/Chat/Messages/Content/ToolApproval.tsx
+++ b/client/src/components/Chat/Messages/Content/ToolApproval.tsx
@@ -401,13 +401,13 @@ export default function ToolApproval({
</Button>
{status === 'expired' && (
<span className="text-text-warning flex items-center text-xs">
- <TriangleAlert className="mr-1.5 h-4 w-4" aria-hidden="true" />
+ <TriangleAlert className="me-1.5 h-4 w-4" aria-hidden="true" />
{localize('com_ui_approval_expired')}
</span>
)}
{status === 'error' && (
<span className="text-text-warning flex items-center text-xs">
- <TriangleAlert className="mr-1.5 h-4 w-4" aria-hidden="true" />
+ <TriangleAlert className="me-1.5 h-4 w-4" aria-hidden="true" />
{localize('com_ui_approval_error')}
</span>
)}
diff --git a/client/src/components/Chat/Messages/Content/ToolCallInfo.tsx b/client/src/components/Chat/Messages/Content/ToolCallInfo.tsx
index e052dceaaa..a1d598589b 100644
--- a/client/src/components/Chat/Messages/Content/ToolCallInfo.tsx
+++ b/client/src/components/Chat/Messages/Content/ToolCallInfo.tsx
@@ -78,13 +78,17 @@ function InputRenderer({ input }: { input: string }) {
}
// Valid JSON but not a plain object (array, string, number, boolean) — render formatted
return (
- <pre className="text-text-primary text-xs whitespace-pre-wrap">
+ <pre dir="ltr" className="text-text-primary text-xs whitespace-pre-wrap">
{typeof parsed === 'string' ? parsed : JSON.stringify(parsed, null, 2)}
</pre>
);
} catch {
// Not JSON — render as plain text
- return <pre className="text-text-primary text-xs whitespace-pre-wrap">{input}</pre>;
+ return (
+ <pre dir="ltr" className="text-text-primary text-xs whitespace-pre-wrap">
+ {input}
+ </pre>
+ );
}
}
diff --git a/client/src/components/Chat/Messages/Content/ToolCallLimitNotice.tsx b/client/src/components/Chat/Messages/Content/ToolCallLimitNotice.tsx
index 68637275e5..a8e2857f94 100644
--- a/client/src/components/Chat/Messages/Content/ToolCallLimitNotice.tsx
+++ b/client/src/components/Chat/Messages/Content/ToolCallLimitNotice.tsx
@@ -85,7 +85,7 @@ export default function ToolCallLimitNotice({ message }: { message: TMessage })
variant="quiet"
size="icon-xs"
aria-label={localize('com_ui_tool_call_limit_dismiss')}
- className="absolute top-1.5 right-1.5 focus-visible:ring-offset-0 focus-visible:ring-inset"
+ className="absolute inset-e-1.5 top-1.5 focus-visible:ring-offset-0 focus-visible:ring-inset"
onClick={() => setDismissed(true)}
>
<X className="h-4 w-4" aria-hidden="true" />
@@ -94,7 +94,7 @@ export default function ToolCallLimitNotice({ message }: { message: TMessage })
/>
<p
id={titleId}
- className="text-text-primary flex min-w-0 items-center gap-2 pr-8 text-sm font-medium"
+ className="text-text-primary flex min-w-0 items-center gap-2 pe-8 text-sm font-medium"
>
<Gauge className="text-text-secondary h-4 w-4 shrink-0" aria-hidden="true" />
{localize('com_ui_tool_call_limit_title')}
diff --git a/client/src/components/Chat/Messages/Content/ToolOutput/OutputRenderer.tsx b/client/src/components/Chat/Messages/Content/ToolOutput/OutputRenderer.tsx
index bb2d2ffd9f..14f5db6588 100644
--- a/client/src/components/Chat/Messages/Content/ToolOutput/OutputRenderer.tsx
+++ b/client/src/components/Chat/Messages/Content/ToolOutput/OutputRenderer.tsx
@@ -179,13 +179,14 @@ export default function OutputRenderer({
<div>
<div className="group/copy relative">
{isJson ? (
- <pre className="max-h-[18.75rem] overflow-auto rounded text-xs">
+ <pre dir="ltr" className="max-h-[18.75rem] overflow-auto rounded text-xs">
<code className="hljs language-json !break-words !whitespace-pre-wrap">
{displayText}
</code>
</pre>
) : (
<pre
+ dir="ltr"
ref={outputRef}
onScroll={terminal ? handleOutputScroll : undefined}
className={cn(
@@ -213,7 +214,7 @@ export default function OutputRenderer({
disabled={contentPending}
iconOnly
label={localize('com_ui_copy')}
- className={cn('bg-presentation absolute right-0 bottom-0 z-[1]', PANE_COPY_REVEAL)}
+ className={cn('bg-presentation absolute inset-e-0 bottom-0 z-[1]', PANE_COPY_REVEAL)}
/>
</div>
{error && rawError && rawError !== displayText && (
@@ -227,7 +228,10 @@ export default function OutputRenderer({
</Button>
)}
{showErrorDetails && rawError && (
- <pre className="text-status-error mt-2 max-h-[12.5rem] overflow-auto font-mono text-xs break-words whitespace-pre-wrap">
+ <pre
+ dir="ltr"
+ className="text-status-error mt-2 max-h-[12.5rem] overflow-auto font-mono text-xs break-words whitespace-pre-wrap"
+ >
{rawError}
</pre>
)}
diff --git a/client/src/components/Chat/Messages/Content/ToolOutput/StackedToolIcons.tsx b/client/src/components/Chat/Messages/Content/ToolOutput/StackedToolIcons.tsx
index 2cf7fae9b0..c0362ca6fa 100644
--- a/client/src/components/Chat/Messages/Content/ToolOutput/StackedToolIcons.tsx
+++ b/client/src/components/Chat/Messages/Content/ToolOutput/StackedToolIcons.tsx
@@ -86,7 +86,7 @@ export default function StackedToolIcons({
className={cn(
'border-border-medium bg-surface-secondary relative flex items-center justify-center rounded-full border',
'h-[1.375rem] w-[1.375rem]',
- index > 0 && '-ml-2.5',
+ index > 0 && '-ms-2.5',
)}
style={{ zIndex: visibleIcons.length - index }}
>
@@ -106,7 +106,7 @@ export default function StackedToolIcons({
<div
className={cn(
'border-border-medium bg-surface-tertiary relative flex items-center justify-center rounded-full border',
- 'text-text-secondary -ml-2.5 h-[1.375rem] w-[1.375rem] text-xs font-medium',
+ 'text-text-secondary -ms-2.5 h-[1.375rem] w-[1.375rem] text-xs font-medium',
)}
style={{ zIndex: 0 }}
>
diff --git a/client/src/components/Chat/Messages/Content/ToolOutput/__tests__/OutputRenderer.test.tsx b/client/src/components/Chat/Messages/Content/ToolOutput/__tests__/OutputRenderer.test.tsx
index 28aa5c7271..41bb3894b6 100644
--- a/client/src/components/Chat/Messages/Content/ToolOutput/__tests__/OutputRenderer.test.tsx
+++ b/client/src/components/Chat/Messages/Content/ToolOutput/__tests__/OutputRenderer.test.tsx
@@ -40,10 +40,10 @@ describe('OutputRenderer', () => {
render(<OutputRenderer text={'First line\nSecond line'} />);
const copyButton = screen.getByTestId('copy-output');
- expect(copyButton).toHaveClass('absolute', 'right-0', 'bottom-0');
+ expect(copyButton).toHaveClass('absolute', 'inset-e-0', 'bottom-0');
expect(copyButton).toHaveClass('no-touch:group-hover/copy:opacity-100');
expect(copyButton.parentElement).toHaveClass('group/copy', 'relative');
- expect(copyButton.parentElement).not.toHaveClass('pr-10');
+ expect(copyButton.parentElement).not.toHaveClass('pe-10');
});
it('copies original bytes when a code result has been formatted for display', () => {
diff --git a/client/src/components/Chat/Messages/Content/UIResourceCarousel.tsx b/client/src/components/Chat/Messages/Content/UIResourceCarousel.tsx
index 4b784bc34a..33b5283d18 100644
--- a/client/src/components/Chat/Messages/Content/UIResourceCarousel.tsx
+++ b/client/src/components/Chat/Messages/Content/UIResourceCarousel.tsx
@@ -26,9 +26,14 @@ const UIResourceCarousel: React.FC<UIResourceCarouselProps> = React.memo(({ uiRe
const handleScroll = React.useCallback(() => {
if (!scrollContainerRef.current) return;
- const { scrollLeft, scrollWidth, clientWidth } = scrollContainerRef.current;
- setShowLeftArrow(scrollLeft > 0);
- setShowRightArrow(scrollLeft < scrollWidth - clientWidth - 10);
+ const container = scrollContainerRef.current;
+ const { scrollLeft, scrollWidth, clientWidth } = container;
+ /** In RTL `scrollLeft` is 0 at the right edge and negative toward the left; normalize to the offset from the left edge. */
+ const maxScroll = scrollWidth - clientWidth;
+ const fromLeft =
+ getComputedStyle(container).direction === 'rtl' ? maxScroll + scrollLeft : scrollLeft;
+ setShowLeftArrow(fromLeft > 0);
+ setShowRightArrow(fromLeft < maxScroll - 10);
}, []);
const scroll = React.useCallback((direction: 'left' | 'right') => {
diff --git a/client/src/components/Chat/Messages/Content/Wakeup.tsx b/client/src/components/Chat/Messages/Content/Wakeup.tsx
index 093128df40..77606854ef 100644
--- a/client/src/components/Chat/Messages/Content/Wakeup.tsx
+++ b/client/src/components/Chat/Messages/Content/Wakeup.tsx
@@ -78,14 +78,14 @@ function WakeupTaskCard({
data-subagent-tool-call={selection.toolCallId}
data-subagent-parent-message={selection.parentMessageId}
data-subagent-part-index={selection.partIndex}
- className="ml-auto h-6 shrink-0 px-2 text-xs"
+ className="ms-auto h-6 shrink-0 px-2 text-xs"
>
{localize('com_ui_wakeup_view_activity')}
</Button>
)}
</div>
{hasResult && (
- <div className="markdown prose prose-sm message-content light text-text-primary mt-2 max-h-96 w-full max-w-none overflow-y-auto pr-1 break-words">
+ <div className="markdown prose prose-sm message-content light text-text-primary mt-2 max-h-96 w-full max-w-none overflow-y-auto pe-1 break-words">
<MarkdownLite content={task.result} codeExecution={false} />
</div>
)}
@@ -203,7 +203,7 @@ const Wakeup = memo(function Wakeup({
)}
{display.tasks.map((task) =>
display.kind === 'background_tool' ? (
- <div key={task.taskId} className="my-2 pl-7">
+ <div key={task.taskId} className="my-2 ps-7">
<BackgroundTaskCard
task={{
taskId: task.taskId,
diff --git a/client/src/components/Chat/Messages/Content/WebSearch.tsx b/client/src/components/Chat/Messages/Content/WebSearch.tsx
index 65079a534d..f0fe0f3cd0 100644
--- a/client/src/components/Chat/Messages/Content/WebSearch.tsx
+++ b/client/src/components/Chat/Messages/Content/WebSearch.tsx
@@ -49,7 +49,7 @@ function SourceFaviconStack({ sources }: { sources: ValidSource[] }) {
className={cn(
'border-border-medium bg-surface-secondary relative flex items-center justify-center rounded-full border',
'h-[1.375rem] w-[1.375rem]',
- i > 0 && '-ml-2.5',
+ i > 0 && '-ms-2.5',
)}
style={{ zIndex: MAX_VISIBLE_FAVICONS - i }}
>
@@ -295,7 +295,7 @@ export default function WebSearch({
variant="quiet"
size="icon"
className={cn(
- 'ml-auto size-auto cursor-help rounded-md p-1 opacity-0',
+ 'ms-auto size-auto cursor-help rounded-md p-1 opacity-0',
'group-focus-within/websearch:opacity-100 group-hover/websearch:opacity-100',
'focus-visible:opacity-100',
)}
@@ -384,7 +384,7 @@ export default function WebSearch({
</span>
)}
</span>
- <span className="shrink-0 text-right">
+ <span className="shrink-0 text-end">
<span className="text-text-secondary text-2xs block">{domain}</span>
{source.date && (
<span className="text-text-secondary text-3xs block">
diff --git a/client/src/components/Chat/Messages/Content/__tests__/ActivityPhaseGroup.test.tsx b/client/src/components/Chat/Messages/Content/__tests__/ActivityPhaseGroup.test.tsx
index fd4851d056..06fc7ec5c7 100644
--- a/client/src/components/Chat/Messages/Content/__tests__/ActivityPhaseGroup.test.tsx
+++ b/client/src/components/Chat/Messages/Content/__tests__/ActivityPhaseGroup.test.tsx
@@ -177,7 +177,7 @@ describe('ActivityPhaseGroup', () => {
for (const token of ROW_GLYPH_SLOT.split(' ')) {
expect(trigger.firstElementChild).toHaveClass(token);
}
- expect(screen.getByText(LABEL).parentElement).toHaveClass('flex-1', 'text-left');
+ expect(screen.getByText(LABEL).parentElement).toHaveClass('flex-1', 'text-start');
});
test.each([
@@ -378,7 +378,7 @@ describe('ActivityPhaseGroup', () => {
);
expect(screen.queryByRole('button')).not.toBeInTheDocument();
- expect(screen.getByText(LABEL)).toHaveClass('text-left');
+ expect(screen.getByText(LABEL)).toHaveClass('text-start');
expect(pendingFrames()).toBe(0);
});
@@ -723,7 +723,7 @@ describe('ActivityPhaseGroup open header', () => {
fireEvent.click(header);
expect(pinned).toHaveClass('sticky', 'top-0', 'bg-surface-primary-alt');
expect(pinned).not.toHaveClass('bg-presentation');
- expect(screen.getByTestId('activity-phase-panel').firstElementChild).toHaveClass('pl-6');
+ expect(screen.getByTestId('activity-phase-panel').firstElementChild).toHaveClass('ps-6');
});
test('collapses from its rail, showing the knob on its header while the rail is hovered', () => {
diff --git a/client/src/components/Chat/Messages/Content/__tests__/Image.test.tsx b/client/src/components/Chat/Messages/Content/__tests__/Image.test.tsx
index a06f5712bb..bb521ec514 100644
--- a/client/src/components/Chat/Messages/Content/__tests__/Image.test.tsx
+++ b/client/src/components/Chat/Messages/Content/__tests__/Image.test.tsx
@@ -117,10 +117,10 @@ describe('Image', () => {
it('aligns only explicitly marked images to the right', () => {
const { rerender } = render(<Image {...defaultProps} />);
const wrapper = screen.getByRole('button').parentElement;
- expect(wrapper).not.toHaveClass('ml-auto');
+ expect(wrapper).not.toHaveClass('ms-auto');
rerender(<Image {...defaultProps} alignRight />);
- expect(wrapper).toHaveClass('ml-auto');
+ expect(wrapper).toHaveClass('ms-auto');
});
it('applies custom className to the button wrapper', () => {
diff --git a/client/src/components/Chat/Messages/Content/__tests__/ToolCallGroup.test.tsx b/client/src/components/Chat/Messages/Content/__tests__/ToolCallGroup.test.tsx
index 7d80c57167..d221d93bbd 100644
--- a/client/src/components/Chat/Messages/Content/__tests__/ToolCallGroup.test.tsx
+++ b/client/src/components/Chat/Messages/Content/__tests__/ToolCallGroup.test.tsx
@@ -1916,7 +1916,7 @@ describe('ToolCallGroup failure fast path', () => {
expect(header).not.toHaveClass('text-text-primary');
fireEvent.click(header);
expect(header).toHaveClass('text-text-primary');
- expect(screen.getByTestId('tool-call-group-panel').firstElementChild).toHaveClass('pl-6');
+ expect(screen.getByTestId('tool-call-group-panel').firstElementChild).toHaveClass('ps-6');
});
it('collapses from its rail, showing the knob on its header while the rail is hovered', () => {
diff --git a/client/src/components/Chat/Messages/Content/__tests__/UIResourceCarousel.test.tsx b/client/src/components/Chat/Messages/Content/__tests__/UIResourceCarousel.test.tsx
index 9e519c1263..20881e1265 100644
--- a/client/src/components/Chat/Messages/Content/__tests__/UIResourceCarousel.test.tsx
+++ b/client/src/components/Chat/Messages/Content/__tests__/UIResourceCarousel.test.tsx
@@ -238,6 +238,28 @@ describe('UIResourceCarousel', () => {
});
});
+ it('normalizes negative scrollLeft in RTL', async () => {
+ const { container } = render(<UIResourceCarousel uiResources={mockUIResources} />);
+ const scrollContainer = container.querySelector<HTMLElement>('.hide-scrollbar');
+
+ scrollContainer!.style.direction = 'rtl';
+ // RTL at its start edge: scrollLeft 0 is the physical right end
+ Object.defineProperty(scrollContainer, 'scrollLeft', { configurable: true, value: 0 });
+ Object.defineProperty(scrollContainer, 'scrollWidth', { configurable: true, value: 1000 });
+ fireEvent.scroll(scrollContainer!);
+ await waitFor(() => {
+ expect(screen.getByLabelText('Scroll left')).toBeInTheDocument();
+ });
+
+ // RTL scrolled to the physical left end: scrollLeft is -(scrollWidth - clientWidth)
+ Object.defineProperty(scrollContainer, 'scrollLeft', { configurable: true, value: -500 });
+ fireEvent.scroll(scrollContainer!);
+ await waitFor(() => {
+ expect(screen.queryByLabelText('Scroll left')).not.toBeInTheDocument();
+ expect(screen.getByLabelText('Scroll right')).toBeInTheDocument();
+ });
+ });
+
it('handles UIResource actions using handleUIAction', async () => {
render(<UIResourceCarousel uiResources={mockUIResources.slice(0, 1)} />);
diff --git a/client/src/components/Chat/Messages/Content/auth.tsx b/client/src/components/Chat/Messages/Content/auth.tsx
index b2b03a7118..8b5aa299b4 100644
--- a/client/src/components/Chat/Messages/Content/auth.tsx
+++ b/client/src/components/Chat/Messages/Content/auth.tsx
@@ -14,8 +14,8 @@ export function ToolAuthWarning({ className }: { className?: string }) {
}
return (
- <p className={cn('flex items-center text-xs text-text-warning', className)}>
- <TriangleAlert className="mr-1.5 inline-block h-4 w-4" aria-hidden="true" />
+ <p className={cn('text-text-warning flex items-center text-xs', className)}>
+ <TriangleAlert className="me-1.5 inline-block h-4 w-4" aria-hidden="true" />
{localize('com_assistants_allow_sites_you_trust')}
</p>
);
diff --git a/client/src/components/Chat/Messages/Content/hydration.tsx b/client/src/components/Chat/Messages/Content/hydration.tsx
index 962dc4a710..10f9dc78c5 100644
--- a/client/src/components/Chat/Messages/Content/hydration.tsx
+++ b/client/src/components/Chat/Messages/Content/hydration.tsx
@@ -99,7 +99,7 @@ export function PreviewedToolCallPart({
{children(effectivePart)}
</ToolContentPendingContext.Provider>
{requested && full == null && query.isError && (
- <div role="alert" className="text-text-warning mb-2 flex items-center gap-2 pl-1 text-xs">
+ <div role="alert" className="text-text-warning mb-2 flex items-center gap-2 ps-1 text-xs">
<span>{localize('com_ui_tool_content_error')}</span>
<button
type="button"
@@ -114,7 +114,7 @@ export function PreviewedToolCallPart({
<div
role="status"
aria-live="polite"
- className="text-text-secondary mb-2 flex items-center gap-1.5 pl-1 text-xs"
+ className="text-text-secondary mb-2 flex items-center gap-1.5 ps-1 text-xs"
>
<Spinner className="size-3" aria-hidden="true" />
<span>{localize('com_ui_tool_content_loading')}</span>
diff --git a/client/src/components/Chat/Messages/Content/markdownConfig.ts b/client/src/components/Chat/Messages/Content/markdownConfig.ts
index 6f07a5f53b..dbf0fa9700 100644
--- a/client/src/components/Chat/Messages/Content/markdownConfig.ts
+++ b/client/src/components/Chat/Messages/Content/markdownConfig.ts
@@ -7,6 +7,22 @@ import rehypeHighlight from 'rehype-highlight';
import remarkDirective from 'remark-directive';
import type { PluggableList } from 'unified';
import type { ElementType } from 'react';
+import {
+ code,
+ a,
+ p,
+ img,
+ table,
+ ul,
+ ol,
+ h1,
+ h2,
+ h3,
+ h4,
+ h5,
+ h6,
+ blockquote,
+} from './MarkdownComponents';
import {
mcpUIResourcePlugin,
MCPUIResource,
@@ -15,7 +31,6 @@ import {
import { Citation, CompositeCitation, HighlightedText } from '~/components/Web/Citation';
import { langSubset, remarkApproxTilde, remarkSingleDollarMath } from '~/utils';
import { Artifact, artifactPlugin } from '~/components/Artifacts/Artifact';
-import { code, a, p, img, table } from './MarkdownComponents';
import { unicodeCitation } from '~/components/Web';
/**
@@ -59,6 +74,15 @@ export const getMarkdownComponents = (): { [nodeType: string]: ElementType } =>
p,
img,
table,
+ ul,
+ ol,
+ h1,
+ h2,
+ h3,
+ h4,
+ h5,
+ h6,
+ blockquote,
artifact: Artifact,
citation: Citation,
'highlighted-text': HighlightedText,
diff --git a/client/src/components/Chat/Messages/Content/rail.tsx b/client/src/components/Chat/Messages/Content/rail.tsx
index ff58e068a7..62cfb48a0a 100644
--- a/client/src/components/Chat/Messages/Content/rail.tsx
+++ b/client/src/components/Chat/Messages/Content/rail.tsx
@@ -55,7 +55,7 @@ export function RailGlyph({ hover, children }: { hover: RailHover; children: Rea
<span className={cn('flex', hovered && 'invisible')}>{children}</span>
{hovered && (
<span
- className={cn(ROW_GLYPH_SLOT, 'text-text-primary absolute inset-y-0 left-0')}
+ className={cn(ROW_GLYPH_SLOT, 'text-text-primary absolute inset-y-0 inset-s-0')}
data-testid="fold-rail-knob"
>
<CircleMinus size={16} />
@@ -94,7 +94,7 @@ export function FoldRail({
tabIndex={-1}
aria-hidden="true"
disabled={!expanded}
- className="group/rail absolute inset-y-0 left-0 w-6 cursor-pointer disabled:pointer-events-none"
+ className="group/rail absolute inset-y-0 inset-s-0 w-6 cursor-pointer disabled:pointer-events-none"
onMouseDown={(event) => event.preventDefault()}
onMouseEnter={() => expanded && hover.set(true)}
onMouseLeave={() => hover.set(false)}
@@ -105,11 +105,11 @@ export function FoldRail({
data-testid="fold-rail"
data-fold-rail=""
>
- <span className="bg-border-medium group-hover/rail:bg-text-secondary absolute top-0.5 bottom-1.5 left-[11px] w-px transition-colors duration-150 motion-reduce:transition-none" />
+ <span className="bg-border-medium group-hover/rail:bg-text-secondary absolute inset-s-[11px] top-0.5 bottom-1.5 w-px transition-colors duration-150 motion-reduce:transition-none" />
{/* The lit path (`useFoldPath`): from the header down to the hovered row, turning
into that row when it is this fold's own. */}
<span
- className="border-text-secondary pointer-events-none absolute top-0.5 left-[11px] h-(--fold-lit) border-l opacity-0 transition-opacity duration-150 group-data-fold-lit/rail:opacity-100 group-data-[fold-lit=end]/rail:w-2 group-data-[fold-lit=end]/rail:rounded-bl-md group-data-[fold-lit=end]/rail:border-b motion-reduce:transition-none"
+ className="border-text-secondary pointer-events-none absolute inset-s-[11px] top-0.5 h-(--fold-lit) border-s opacity-0 transition-opacity duration-150 group-data-fold-lit/rail:opacity-100 group-data-[fold-lit=end]/rail:w-2 group-data-[fold-lit=end]/rail:rounded-es-md group-data-[fold-lit=end]/rail:border-b motion-reduce:transition-none"
data-testid="fold-rail-path"
/>
</button>
diff --git a/client/src/components/Chat/Messages/Content/rows.ts b/client/src/components/Chat/Messages/Content/rows.ts
index b535369d69..c1bcff0fbc 100644
--- a/client/src/components/Chat/Messages/Content/rows.ts
+++ b/client/src/components/Chat/Messages/Content/rows.ts
@@ -8,7 +8,7 @@
export const TOOL_ROW_CLASSES = 'relative my-1.5 flex h-5 shrink-0 items-center gap-2.5';
/** Leave an 8px gap beside MessageNav's hit area in full-width chat. */
-export const ARTIFACT_ROW_NAV_SPACING = 'pr-3 md:pr-17';
+export const ARTIFACT_ROW_NAV_SPACING = 'pe-3 md:pe-17';
/** Behavior hook for header glyphs, independent of their layout. */
export const FOLD_GLYPH_CLASS = 'fold-glyph';
@@ -38,7 +38,7 @@ export const FOLD_GLYPH_SELECTOR = `.${FOLD_GLYPH_CLASS}`;
* drawn 12px left of the row, show at all. The rail is absolutely positioned
* in that inset, out of flow, so the height animation is untouched.
*/
-export const FOLD_RAIL_CLASSES = 'relative pl-6';
+export const FOLD_RAIL_CLASSES = 'relative ps-6';
/**
* A copy action laid over its pane (`group/copy`) instead of beside it, so it
diff --git a/client/src/components/Chat/Messages/Fork.tsx b/client/src/components/Chat/Messages/Fork.tsx
index 6ae32b5f04..80cf73821a 100644
--- a/client/src/components/Chat/Messages/Fork.tsx
+++ b/client/src/components/Chat/Messages/Fork.tsx
@@ -172,14 +172,14 @@ const CheckboxOption: React.FC<CheckboxOptionProps> = ({
<Label
htmlFor={id}
variant="secondary"
- className="hover:text-text-primary ml-2 w-auto cursor-pointer text-sm break-normal select-none"
+ className="hover:text-text-primary ms-2 w-auto cursor-pointer text-sm break-normal select-none"
>
{localize(labelKey)}
</Label>
</div>
}
/>
- <Ariakit.HovercardDisclosure className="text-text-secondary focus:ring-text-primary ml-1 rounded-full focus:ring-2 focus:outline-hidden">
+ <Ariakit.HovercardDisclosure className="text-text-secondary focus:ring-text-primary ms-1 rounded-full focus:ring-2 focus:outline-hidden">
<VisuallyHidden>{localize(infoKey)}</VisuallyHidden>
{chevronDown}
</Ariakit.HovercardDisclosure>
@@ -366,7 +366,7 @@ function Fork({
<div className="text-text-primary flex h-8 w-full items-center justify-center text-sm">
{localize(activeSetting)}
<Ariakit.HovercardProvider placement="right-start">
- <div className="ml-auto flex h-6 w-6 items-center justify-center gap-1">
+ <div className="ms-auto flex h-6 w-6 items-center justify-center gap-1">
<Ariakit.HovercardAnchor
render={
<button
diff --git a/client/src/components/Chat/Messages/HoverButtons.tsx b/client/src/components/Chat/Messages/HoverButtons.tsx
index d955ce11b7..2a8764e610 100644
--- a/client/src/components/Chat/Messages/HoverButtons.tsx
+++ b/client/src/components/Chat/Messages/HoverButtons.tsx
@@ -229,7 +229,7 @@ const HoverButtons = ({
isLast={isLast}
disabled={!canCopy}
className={cn(
- 'ml-0 flex items-center gap-1.5 text-xs',
+ 'ms-0 flex items-center gap-1.5 text-xs',
isSubmitting && isCreatedByUser ? 'no-touch:opacity-0 group-hover:opacity-100' : '',
)}
dataTestId={!isCreatedByUser ? 'copy-response-button' : undefined}
diff --git a/client/src/components/Chat/Messages/MessageNav.tsx b/client/src/components/Chat/Messages/MessageNav.tsx
index fae96b0131..f0117d2a1a 100644
--- a/client/src/components/Chat/Messages/MessageNav.tsx
+++ b/client/src/components/Chat/Messages/MessageNav.tsx
@@ -349,7 +349,7 @@ const MessageIndicator = memo(function MessageIndicator({
<span
className={cn(
'block rounded-full',
- entry.isEnd === true || entry.isStart === true ? 'mr-[0.28125rem]' : '',
+ entry.isEnd === true || entry.isStart === true ? 'me-[0.28125rem]' : '',
tone,
)}
style={{ width: pxToRem(dims.baseW), height: pxToRem(dims.baseH) }}
@@ -359,7 +359,7 @@ const MessageIndicator = memo(function MessageIndicator({
});
const chevronButtonClasses = cn(
- '-mr-1 rounded-md p-0.5 text-text-tertiary opacity-40 transition-[color,opacity] duration-300 high-contrast:opacity-50',
+ '-me-1 rounded-md p-0.5 text-text-tertiary opacity-40 transition-[color,opacity] duration-300 high-contrast:opacity-50',
'group-hover/nav:text-text-secondary group-hover/nav:opacity-100',
'group-focus-within/nav:text-text-secondary group-focus-within/nav:opacity-100',
'group-hover/nav:hover:text-text-primary',
@@ -435,9 +435,9 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
const tipShownRef = useRef(false);
const tipTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const tipElRef = useRef<HTMLDivElement | null>(null);
- const tipPosRef = useRef({ top: 0, right: 0 });
+ const tipPosRef = useRef({ top: 0, inlineEnd: 0 });
- const [tip, setTip] = useState<{ id: string; top: number; right: number } | null>(null);
+ const [tip, setTip] = useState<{ id: string; top: number; inlineEnd: number } | null>(null);
const [hoveredId, setHoveredId] = useState<string | null>(null);
/** The rib the keyboard last landed on. A roving tab stop has to travel with
* focus, not sit on the scroll-spy's current rib: leave it behind and the
@@ -879,12 +879,19 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
};
}, [entries, currentId, measureRibs]);
- const positionTip = useCallback((top: number, right: number) => {
- tipPosRef.current = { top, right };
+ /** Distance from the viewport edge the tooltip shares with the column: the right edge in LTR, the left in RTL. */
+ const tipInlineEnd = useCallback((rect: { left: number; right: number }) => {
+ const rtl =
+ columnRef.current != null && getComputedStyle(columnRef.current).direction === 'rtl';
+ return rtl ? rect.right + 8 : window.innerWidth - rect.left + 8;
+ }, []);
+
+ const positionTip = useCallback((top: number, inlineEnd: number) => {
+ tipPosRef.current = { top, inlineEnd };
const el = tipElRef.current;
if (el) {
el.style.top = `${top}px`;
- el.style.right = `${right}px`;
+ el.style.insetInlineEnd = `${inlineEnd}px`;
}
}, []);
@@ -894,7 +901,7 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
setTip(null);
return;
}
- setTip({ id, top: tipPosRef.current.top, right: tipPosRef.current.right });
+ setTip({ id, top: tipPosRef.current.top, inlineEnd: tipPosRef.current.inlineEnd });
},
[entryById],
);
@@ -915,8 +922,8 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
}, []);
const focusTooltip = useCallback(
- (id: string, top: number, right: number) => {
- positionTip(top, right);
+ (id: string, top: number, inlineEnd: number) => {
+ positionTip(top, inlineEnd);
if (focusedIdRef.current === id) {
return;
}
@@ -943,10 +950,10 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
const showTerminusTip = useCallback(
(el: HTMLElement, id: string) => {
const rect = el.getBoundingClientRect();
- const left = columnRef.current?.getBoundingClientRect().left ?? rect.left;
- focusTooltip(id, rect.top + rect.height / 2, window.innerWidth - left + 8);
+ const colRect = columnRef.current?.getBoundingClientRect() ?? rect;
+ focusTooltip(id, rect.top + rect.height / 2, tipInlineEnd(colRect));
},
- [focusTooltip],
+ [focusTooltip, tipInlineEnd],
);
const handleEndPointerEnter = useCallback(
@@ -1017,12 +1024,11 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
}
if (nearestId != null && nearestD <= influence && !isDraggingRef.current) {
const top = colRect.top - scrollTop + nearestCenter;
- const right = window.innerWidth - colRect.left + 8;
- focusTooltip(nearestId, top, right);
+ focusTooltip(nearestId, top, tipInlineEnd(colRect));
} else {
clearTooltip();
}
- }, [focusTooltip, clearTooltip, ensureRibLayout]);
+ }, [focusTooltip, clearTooltip, ensureRibLayout, tipInlineEnd]);
/** Restores the resting dimensions rather than clearing them: the ribs carry
* their base size inline, from the same `ribDimsFor` the magnifier reads, so
@@ -1613,7 +1619,7 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
aria-label={localize('com_ui_message_nav')}
aria-keyshortcuts="Shift+Alt+M"
className={cn(
- 'group/nav absolute top-1/2 right-2 z-40 hidden max-h-[min(24rem,calc(100%-2rem))]',
+ 'group/nav absolute inset-e-2 top-1/2 z-40 hidden max-h-[min(24rem,calc(100%-2rem))]',
'-translate-y-1/2 flex-col items-end gap-1.5 px-1.5 py-2 md:flex',
)}
>
@@ -1722,13 +1728,15 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
<div
ref={tipElRef}
role="tooltip"
- style={{
- top: tip.top,
- right: tip.right,
- transform: 'translateY(-50%)',
- zIndex: 999,
- }}
- className="border-border-light bg-surface-secondary text-text-secondary pointer-events-none fixed max-w-[17.5rem] rounded-xl border px-3 py-2 shadow-lg"
+ style={
+ {
+ top: tip.top,
+ '--tip-inline-end': `${tip.inlineEnd}px`,
+ transform: 'translateY(-50%)',
+ zIndex: 999,
+ } as React.CSSProperties
+ }
+ className="border-border-light bg-surface-secondary text-text-secondary pointer-events-none fixed inset-e-(--tip-inline-end) max-w-[17.5rem] rounded-xl border px-3 py-2 shadow-lg"
>
<p className="line-clamp-3 text-xs">{tipText}</p>
</div>,
diff --git a/client/src/components/Chat/Messages/MinimalHoverButtons.tsx b/client/src/components/Chat/Messages/MinimalHoverButtons.tsx
index a893e65377..257afbe5ea 100644
--- a/client/src/components/Chat/Messages/MinimalHoverButtons.tsx
+++ b/client/src/components/Chat/Messages/MinimalHoverButtons.tsx
@@ -47,7 +47,7 @@ export default function MinimalHoverButtons({ message, searchResults, variant }:
? localize('com_ui_copied_to_clipboard')
: localize('com_ui_copy_to_clipboard')
}
- className={cn('ml-0 flex items-center gap-1.5 text-xs', revealOnRowHoverClasses)}
+ className={cn('ms-0 flex items-center gap-1.5 text-xs', revealOnRowHoverClasses)}
disabled={!canCopy}
onClick={() => copyToClipboard(setIsCopied)}
>
diff --git a/client/src/components/Chat/Messages/SiblingSwitch.tsx b/client/src/components/Chat/Messages/SiblingSwitch.tsx
index 75c94a9602..5528e0386d 100644
--- a/client/src/components/Chat/Messages/SiblingSwitch.tsx
+++ b/client/src/components/Chat/Messages/SiblingSwitch.tsx
@@ -51,7 +51,7 @@ export default function SiblingSwitch({
aria-label={localize('com_ui_previous_sibling')}
aria-disabled={siblingIdx == 0}
>
- <ChevronLeft size="19" aria-hidden="true" />
+ <ChevronLeft size="19" className="rtl:-scale-x-100" aria-hidden="true" />
</Button>
<span
className="shrink-0 grow tabular-nums"
@@ -59,7 +59,9 @@ export default function SiblingSwitch({
aria-atomic="true"
role="status"
>
- {siblingIdx + 1} / {siblingCount}
+ <bdi>
+ {siblingIdx + 1} / {siblingCount}
+ </bdi>
</span>
<Button
variant="message-action"
@@ -69,7 +71,7 @@ export default function SiblingSwitch({
aria-label={localize('com_ui_next_sibling')}
aria-disabled={siblingIdx == siblingCount - 1}
>
- <ChevronRight size="19" aria-hidden="true" />
+ <ChevronRight size="19" className="rtl:-scale-x-100" aria-hidden="true" />
</Button>
</nav>
) : null;
diff --git a/client/src/components/Chat/Messages/ui/MessageRow.tsx b/client/src/components/Chat/Messages/ui/MessageRow.tsx
index b6885eda2f..d17fb20f6f 100644
--- a/client/src/components/Chat/Messages/ui/MessageRow.tsx
+++ b/client/src/components/Chat/Messages/ui/MessageRow.tsx
@@ -57,7 +57,7 @@ function renderAuthorHeader({
return (
<h2 className={authorHeaderClasses[align]}>
{align === 'end' && (
- <MessageTimestamp value={timestamp} className="mr-auto shrink-0 font-normal" />
+ <MessageTimestamp value={timestamp} className="me-auto shrink-0 font-normal" />
)}
<span
aria-hidden="true"
@@ -68,7 +68,7 @@ function renderAuthorHeader({
<span className="sr-only">{headerPrefix}</span>
<HeaderLabel label={label} hoverLabel={hoverLabel} />
{align === 'start' && (
- <MessageTimestamp value={timestamp} className="ml-auto shrink-0 font-normal" />
+ <MessageTimestamp value={timestamp} className="ms-auto shrink-0 font-normal" />
)}
</h2>
);
@@ -133,12 +133,12 @@ export default function MessageRow({
(hasParallelContent || isEditing) && 'w-full',
!hasParallelContent &&
isUserSide &&
- cn('ml-auto items-end', !isEditing && 'w-fit max-w-[90%] sm:max-w-[85%]'),
+ cn('ms-auto items-end', !isEditing && 'w-fit max-w-[90%] sm:max-w-[85%]'),
!hasParallelContent && !isUserSide && !isEditing && 'flex-1',
)}
>
{isSystem && (
- <h2 className="text-text-secondary mb-1 flex items-center gap-1.5 pr-1.5 text-xs font-medium select-none">
+ <h2 className="text-text-secondary mb-1 flex items-center gap-1.5 pe-1.5 text-xs font-medium select-none">
<Zap size={12} aria-hidden="true" />
{systemLabel}
<span className="sr-only">
@@ -171,7 +171,7 @@ export default function MessageRow({
'flex min-h-[1.25rem] max-w-full grow flex-col gap-0',
isUserSide && !isEditing
? cn(
- 'rounded-theme-surface rounded-br-theme-control px-theme-normal w-fit',
+ 'rounded-theme-surface rounded-ee-theme-control px-theme-normal w-fit',
isSystem || outlined
? 'border-border-medium border py-1.5'
: 'bg-surface-user-message py-2.5',
diff --git a/client/src/components/Chat/Messages/ui/MessageTimestamp.tsx b/client/src/components/Chat/Messages/ui/MessageTimestamp.tsx
index e3262ee84f..69e128a11b 100644
--- a/client/src/components/Chat/Messages/ui/MessageTimestamp.tsx
+++ b/client/src/components/Chat/Messages/ui/MessageTimestamp.tsx
@@ -19,9 +19,9 @@ function TimestampText({
dateTime={timestamp.iso}
title={timestamp.isRecent ? timestamp.absolute : undefined}
className={cn(
- 'message-timestamp text-xs font-normal text-text-secondary',
+ 'message-timestamp text-text-secondary text-xs font-normal',
revealOnHover &&
- 'ml-2 transition-opacity duration-theme-normal ease-out motion-reduce:transition-none',
+ 'duration-theme-normal ms-2 transition-opacity ease-out motion-reduce:transition-none',
className,
)}
>
diff --git a/client/src/components/Chat/Messages/ui/SystemEvent.tsx b/client/src/components/Chat/Messages/ui/SystemEvent.tsx
index 7b92d53870..0a0d8dca79 100644
--- a/client/src/components/Chat/Messages/ui/SystemEvent.tsx
+++ b/client/src/components/Chat/Messages/ui/SystemEvent.tsx
@@ -58,7 +58,7 @@ export default function SystemEventHeader({
{expanded != null && (
<ChevronDown
className={cn(
- 'text-text-secondary ml-auto size-4 shrink-0 transition-transform duration-200 ease-out motion-reduce:transition-none',
+ 'text-text-secondary ms-auto size-4 shrink-0 transition-transform duration-200 ease-out motion-reduce:transition-none',
expanded && 'rotate-180',
)}
aria-hidden="true"
diff --git a/client/src/components/Chat/Messages/ui/__tests__/MessageRow.spec.tsx b/client/src/components/Chat/Messages/ui/__tests__/MessageRow.spec.tsx
index 2c95e2e2b4..cd0a360226 100644
--- a/client/src/components/Chat/Messages/ui/__tests__/MessageRow.spec.tsx
+++ b/client/src/components/Chat/Messages/ui/__tests__/MessageRow.spec.tsx
@@ -154,7 +154,7 @@ describe('MessageRow', () => {
const row = screen.getByLabelText('Assistant message');
const agentTurn = row.querySelector('.agent-turn');
- expect(agentTurn).not.toHaveClass('md:pl-9', 'pl-9');
+ expect(agentTurn).not.toHaveClass('md:ps-9', 'ps-9');
expect(row).not.toHaveClass('gap-3');
expect(row.children).toHaveLength(1);
expect(screen.getAllByTestId('message-icon')).toHaveLength(1);
@@ -166,7 +166,7 @@ describe('MessageRow', () => {
const heading = screen.getByRole('heading', { name: 'Message from Assistant Model: gpt-5.6' });
expect(heading).toHaveClass('w-full', 'gap-2');
- expect(screen.getByTestId('message-timestamp')).toHaveClass('ml-auto');
+ expect(screen.getByTestId('message-timestamp')).toHaveClass('ms-auto');
});
it('keeps the model name ready to replace the provider on hover', () => {
@@ -214,7 +214,7 @@ describe('MessageRow', () => {
const messageSurface = screen.getByTestId('message-body');
expect(row.querySelector('.agent-turn')).toHaveClass('w-full');
- expect(row.querySelector('.agent-turn')).not.toHaveClass('md:pl-9');
+ expect(row.querySelector('.agent-turn')).not.toHaveClass('md:ps-9');
expect(messageSurface).toHaveClass('w-full');
});
diff --git a/client/src/components/Chat/PullRequest/Card.tsx b/client/src/components/Chat/PullRequest/Card.tsx
index 5140e002f0..af23533a9d 100644
--- a/client/src/components/Chat/PullRequest/Card.tsx
+++ b/client/src/components/Chat/PullRequest/Card.tsx
@@ -41,7 +41,7 @@ function PullRequestCard({
<span className="text-text-primary text-sm font-medium">
{localize(view.labelKey, { 0: pullRequest.number })}
</span>
- <span className="ml-auto flex items-center gap-1.5 text-xs font-medium">
+ <span className="ms-auto flex items-center gap-1.5 text-xs font-medium">
<span
className="text-status-success"
aria-label={localize('com_ui_pr_additions', { 0: pullRequest.additions })}
diff --git a/client/src/components/Chat/PullRequest/Panel.tsx b/client/src/components/Chat/PullRequest/Panel.tsx
index c114671a15..1f47b8555d 100644
--- a/client/src/components/Chat/PullRequest/Panel.tsx
+++ b/client/src/components/Chat/PullRequest/Panel.tsx
@@ -8,9 +8,9 @@ import { cn } from '~/utils';
/** Slides in from the anchor's side, left to right, and fades; reduced motion only fades. */
export const panelClass = cn(
'border-border-light bg-surface-secondary text-text-primary z-[200] w-80 max-w-[calc(100vw-2rem)] rounded-xl border shadow-lg focus:outline-none',
- 'origin-left -translate-x-3 opacity-0 transition duration-200 ease-out',
+ 'origin-left rtl:origin-right -translate-x-3 rtl:translate-x-3 opacity-0 transition duration-200 ease-out',
'data-[enter]:translate-x-0 data-[enter]:opacity-100',
- 'data-[leave]:-translate-x-3 data-[leave]:opacity-0',
+ 'data-[leave]:-translate-x-3 rtl:data-[leave]:translate-x-3 data-[leave]:opacity-0',
'motion-reduce:translate-x-0 motion-reduce:transition-opacity',
);
diff --git a/client/src/components/Chat/PullRequest/RowMark.tsx b/client/src/components/Chat/PullRequest/RowMark.tsx
index fc328840cc..5dde27ad74 100644
--- a/client/src/components/Chat/PullRequest/RowMark.tsx
+++ b/client/src/components/Chat/PullRequest/RowMark.tsx
@@ -89,7 +89,7 @@ function PullRequestRowMark({
onKeyDown={(event: React.KeyboardEvent) => {
if (event.key === 'Enter' || event.key === ' ') event.stopPropagation();
}}
- className="focus-visible:ring-text-primary text-status-warning relative mr-1 flex size-4 shrink-0 items-center justify-center rounded-sm outline-hidden focus-visible:ring-2"
+ className="focus-visible:ring-text-primary text-status-warning relative me-1 flex size-4 shrink-0 items-center justify-center rounded-sm outline-hidden focus-visible:ring-2"
>
<TriangleAlert aria-hidden="true" className="size-4 shrink-0" />
</Ariakit.HovercardAnchor>
@@ -150,7 +150,7 @@ function PullRequestRowMark({
if (event.key === 'Enter' || event.key === ' ') event.stopPropagation();
}}
className={cn(
- 'focus-visible:ring-text-primary relative mr-1 flex size-4 shrink-0 items-center justify-center rounded-sm outline-hidden focus-visible:ring-2',
+ 'focus-visible:ring-text-primary relative me-1 flex size-4 shrink-0 items-center justify-center rounded-sm outline-hidden focus-visible:ring-2',
)}
>
<PullRequestIcon icon={view.icon} tone={view.iconTone} className="size-4 shrink-0" />
diff --git a/client/src/components/Chat/PullRequest/__tests__/RowMark.test.tsx b/client/src/components/Chat/PullRequest/__tests__/RowMark.test.tsx
index 6d8ecaa5e6..ad84527ac4 100644
--- a/client/src/components/Chat/PullRequest/__tests__/RowMark.test.tsx
+++ b/client/src/components/Chat/PullRequest/__tests__/RowMark.test.tsx
@@ -173,11 +173,11 @@ describe('PullRequestRowMark', () => {
it('keeps its spacing on the rendered mark, so an absent mark takes no room', async () => {
mockGetMany.mockResolvedValue(answer('convo-1', pr));
const first = renderMark();
- expect(await screen.findByTestId('convo-pull-request')).toHaveClass('mr-1');
+ expect(await screen.findByTestId('convo-pull-request')).toHaveClass('me-1');
first.unmount();
mockGetMany.mockRejectedValueOnce(new Error('503'));
renderMark();
- expect(await screen.findByTestId('convo-pull-request-failed')).toHaveClass('mr-1');
+ expect(await screen.findByTestId('convo-pull-request-failed')).toHaveClass('me-1');
});
it('falls back to the single route when the replica that answered has no batch route', async () => {
diff --git a/client/src/components/Chat/SubagentThreadLink.tsx b/client/src/components/Chat/SubagentThreadLink.tsx
index 3833aba568..77ecd14a90 100644
--- a/client/src/components/Chat/SubagentThreadLink.tsx
+++ b/client/src/components/Chat/SubagentThreadLink.tsx
@@ -40,7 +40,7 @@ export default function SubagentThreadLink({
title={label}
onClick={() => navigateToConvo(targetConversation)}
>
- <ChevronLeft size={16} aria-hidden="true" />
+ <ChevronLeft size={16} className="rtl:-scale-x-100" aria-hidden="true" />
<span className={labelClassName}>{label}</span>
</Button>
);
diff --git a/client/src/components/Chat/Subagents/EventSubagentActivityGroup.tsx b/client/src/components/Chat/Subagents/EventSubagentActivityGroup.tsx
index cd65b3d209..024278996c 100644
--- a/client/src/components/Chat/Subagents/EventSubagentActivityGroup.tsx
+++ b/client/src/components/Chat/Subagents/EventSubagentActivityGroup.tsx
@@ -161,7 +161,7 @@ function EventSubagentRows({
aria-expanded={expanded}
aria-controls={panelId}
aria-label={`${localize('com_ui_subagent_activity')}: ${summary}`}
- className="focus-visible:ring-ring-primary flex h-auto min-h-10 w-full items-center justify-start px-3 text-left focus-visible:ring-offset-0 focus-visible:ring-inset"
+ className="focus-visible:ring-ring-primary flex h-auto min-h-10 w-full items-center justify-start px-3 text-start focus-visible:ring-offset-0 focus-visible:ring-inset"
>
<Bot size={15} className="shrink-0" aria-hidden="true" />
<span className="min-w-0 flex-1 truncate text-sm font-medium">{summary}</span>
@@ -191,7 +191,7 @@ function EventSubagentRows({
data-subagent-parent-message={child.parentMessageId}
data-subagent-part-index="0"
className={cn(
- 'focus-visible:ring-ring-primary flex w-full items-center gap-2 px-3 py-2 text-left text-sm focus-visible:ring-2 focus-visible:outline-hidden focus-visible:ring-inset',
+ 'focus-visible:ring-ring-primary flex w-full items-center gap-2 px-3 py-2 text-start text-sm focus-visible:ring-2 focus-visible:outline-hidden focus-visible:ring-inset',
canOpen ? 'hover:bg-surface-hover' : 'cursor-default opacity-70',
)}
>
diff --git a/client/src/components/Chat/Subagents/SharedSubagentActivityDialog.tsx b/client/src/components/Chat/Subagents/SharedSubagentActivityDialog.tsx
index 01c26a7ff4..64376d029b 100644
--- a/client/src/components/Chat/Subagents/SharedSubagentActivityDialog.tsx
+++ b/client/src/components/Chat/Subagents/SharedSubagentActivityDialog.tsx
@@ -119,7 +119,7 @@ export default function SharedSubagentActivityDialog({
className="flex h-[min(90vh,48rem)] w-11/12 max-w-3xl flex-col gap-0 overflow-hidden p-0"
onCloseAutoFocus={restoreTriggerFocus}
>
- <OGDialogHeader className="border-border-light shrink-0 border-b px-5 py-4 pr-14">
+ <OGDialogHeader className="border-border-light shrink-0 border-b px-5 py-4 pe-14">
<div className="flex min-w-0 items-center gap-2">
<span
aria-hidden="true"
@@ -127,7 +127,7 @@ export default function SharedSubagentActivityDialog({
>
{childAuthor.icon}
</span>
- <OGDialogTitle className="truncate text-left text-base" title={title}>
+ <OGDialogTitle className="truncate text-start text-base" title={title}>
{title}
</OGDialogTitle>
</div>
diff --git a/client/src/components/Chat/Subagents/SubagentActivity.tsx b/client/src/components/Chat/Subagents/SubagentActivity.tsx
index 695a195e1e..2e2dfab50e 100644
--- a/client/src/components/Chat/Subagents/SubagentActivity.tsx
+++ b/client/src/components/Chat/Subagents/SubagentActivity.tsx
@@ -85,7 +85,7 @@ function SubagentControlHistory({
<span className="min-w-0 flex-1 font-medium">
{localize(CONTROL_ACTION_LABELS[control.action])}
</span>
- <span className="text-text-secondary ml-auto shrink-0 text-xs" aria-live="polite">
+ <span className="text-text-secondary ms-auto shrink-0 text-xs" aria-live="polite">
{localize(CONTROL_STATUS_LABELS[control.status])}
</span>
{control.status === 'accepted' &&
@@ -106,7 +106,7 @@ function SubagentControlHistory({
<div className="text-text-secondary mt-1 break-words">
{control.message}
{control.messageTruncated === true && (
- <span className="ml-1 text-xs italic">
+ <span className="ms-1 text-xs italic">
{localize('com_ui_subagent_control_message_truncated')}
</span>
)}
diff --git a/client/src/components/Chat/Trace/Inspector.tsx b/client/src/components/Chat/Trace/Inspector.tsx
index f5b9bc925f..a2f90b60b0 100644
--- a/client/src/components/Chat/Trace/Inspector.tsx
+++ b/client/src/components/Chat/Trace/Inspector.tsx
@@ -35,7 +35,7 @@ function Section({ title, fields }: { title: TranslationKeys; fields: Field[] })
{fields.map((field) => (
<div key={field.label} className="contents">
<dt className="text-text-secondary">{localize(field.label)}</dt>
- <dd className="text-text-primary min-w-0 text-right break-words tabular-nums">
+ <dd className="text-text-primary min-w-0 text-end break-words tabular-nums">
{field.value}
</dd>
</div>
@@ -193,7 +193,7 @@ function AgentCard({ agent, agentId }: { agent: RecordPresentation['agent']; age
{agent == null && (
<p className="text-text-secondary text-sm">{localize('com_ui_trace_agent_unavailable')}</p>
)}
- <div className="border-border-light bg-surface-primary-alt flex items-center gap-1 rounded-lg border py-0.5 pr-0.5 pl-2.5">
+ <div className="border-border-light bg-surface-primary-alt flex items-center gap-1 rounded-lg border py-0.5 ps-2.5 pe-0.5">
<span className="text-text-secondary min-w-0 flex-1 truncate font-mono text-xs select-all">
{agentId}
</span>
@@ -363,7 +363,7 @@ function Inspector({
<aside
aria-labelledby={headingId}
data-testid="trace-inspector"
- className="border-border-light bg-presentation flex min-h-0 flex-col max-md:absolute max-md:inset-x-0 max-md:bottom-0 max-md:z-20 max-md:max-h-[65%] max-md:rounded-t-2xl max-md:border-t max-md:shadow-lg md:w-[22rem] md:shrink-0 md:border-l"
+ className="border-border-light bg-presentation flex min-h-0 flex-col max-md:absolute max-md:inset-x-0 max-md:bottom-0 max-md:z-20 max-md:max-h-[65%] max-md:rounded-t-2xl max-md:border-t max-md:shadow-lg md:w-[22rem] md:shrink-0 md:border-s"
>
<div className="border-border-light flex items-center gap-2 border-b px-3 py-2">
{presentation.agent !== undefined &&
@@ -377,7 +377,7 @@ function Inspector({
<h3 id={headingId} className="min-w-0 flex-1 truncate text-sm font-semibold">
{presentation.title}
{presentation.caption != null && (
- <span className="text-text-secondary ml-1.5 text-xs font-normal">
+ <span className="text-text-secondary ms-1.5 text-xs font-normal">
{presentation.caption}
</span>
)}
diff --git a/client/src/components/Chat/Trace/Ledger.tsx b/client/src/components/Chat/Trace/Ledger.tsx
index 3847e1fa9d..7d95f6ba49 100644
--- a/client/src/components/Chat/Trace/Ledger.tsx
+++ b/client/src/components/Chat/Trace/Ledger.tsx
@@ -174,7 +174,7 @@ function Ledger({
: '';
const costCell = (cost?: number) =>
showCost && (
- <span className="text-text-secondary hidden truncate text-right text-xs font-normal tabular-nums md:block">
+ <span className="text-text-secondary hidden truncate text-end text-xs font-normal tabular-nums md:block">
{cost != null ? formatCost(cost, currency) : ''}
</span>
);
@@ -277,7 +277,11 @@ function Ledger({
Enter: () => activate(activeRow),
' ': () => activate(activeRow),
};
- const handler = handlers[event.key];
+ /** Read from the tree itself so an LTR island inside an RTL page keeps its own arrows. */
+ const rtl = getComputedStyle(event.currentTarget).direction === 'rtl';
+ const mirror: Record<string, string> = { ArrowLeft: 'ArrowRight', ArrowRight: 'ArrowLeft' };
+ const key = rtl ? (mirror[event.key] ?? event.key) : event.key;
+ const handler = handlers[key];
if (handler) {
event.preventDefault();
handler();
@@ -289,7 +293,7 @@ function Ledger({
aria-hidden="true"
className={cn(
'text-text-secondary size-3.5 shrink-0 transition-transform motion-reduce:transition-none',
- expanded && 'rotate-90',
+ expanded ? 'rotate-90' : 'rtl:-scale-x-100',
)}
/>
);
@@ -376,7 +380,10 @@ function Ledger({
active && ACTIVE_RING,
)}
>
- <span className="flex min-w-0 items-center gap-1.5" style={{ paddingLeft: indent }}>
+ <span
+ className="flex min-w-0 items-center gap-1.5 ps-(--indent)"
+ style={{ '--indent': `${indent}px` } as CSSProperties}
+ >
{chevron(row.expanded)}
<span className="shrink-0 truncate">{label}</span>
{agents.map(({ agentId, recordId }) => {
@@ -393,7 +400,7 @@ function Ledger({
}}
onKeyDown={(event) => event.stopPropagation()}
className={cn(
- 'border-border-light hover:bg-surface-hover flex max-w-[45%] shrink-0 items-center gap-1 rounded-full border py-0.5 pr-2 pl-0.5 font-medium',
+ 'border-border-light hover:bg-surface-hover flex max-w-[45%] shrink-0 items-center gap-1 rounded-full border py-0.5 ps-0.5 pe-2 font-medium',
selectedId === recordId && 'bg-surface-active-alt',
)}
>
@@ -409,14 +416,14 @@ function Ledger({
<CircleAlert aria-hidden="true" className="text-status-error size-3.5 shrink-0" />
)}
</span>
- <span className="text-text-secondary text-right font-normal tabular-nums">
+ <span className="text-text-secondary text-end font-normal tabular-nums">
{format.duration(
row.type === 'turn' ? row.turn.end - row.turn.start : row.step.end - row.step.start,
)}
</span>
<span className="hidden md:block" />
{costCell(row.type === 'turn' ? row.turn.cost : row.step.cost)}
- <span className="relative h-full overflow-hidden">
+ <span dir="ltr" className="relative h-full overflow-hidden">
<GroupBar span={span} domain={domainFor(messageId)} />
</span>
</div>
@@ -499,8 +506,8 @@ function Ledger({
)}
>
<span
- className="flex min-w-0 items-center gap-1.5"
- style={{ paddingLeft: (row.level - 2) * INDENT_PX }}
+ className="flex min-w-0 items-center gap-1.5 ps-(--indent)"
+ style={{ '--indent': `${(row.level - 2) * INDENT_PX}px` } as CSSProperties}
>
<span
aria-hidden="true"
@@ -568,14 +575,14 @@ function Ledger({
<CircleDashed aria-hidden="true" className="text-text-secondary size-3.5 shrink-0" />
)}
</span>
- <span className="text-text-secondary truncate text-right text-xs tabular-nums">
+ <span className="text-text-secondary truncate text-end text-xs tabular-nums">
{duration}
</span>
- <span className="text-text-secondary hidden text-right text-xs tabular-nums md:block">
+ <span className="text-text-secondary hidden text-end text-xs tabular-nums md:block">
{recordTokens(node)}
</span>
{costCell(record.cost)}
- <span className="relative h-full overflow-hidden">
+ <span dir="ltr" className="relative h-full overflow-hidden">
<RecordBar node={node} scale={scale} domain={domainFor(record.messageId)} />
</span>
</div>
@@ -614,15 +621,13 @@ function Ledger({
)}
>
<span>{localize('com_ui_trace_column_name')}</span>
- <span className="text-right">{localize('com_ui_trace_column_duration')}</span>
- <span className="hidden text-right md:block">{localize('com_ui_trace_column_tokens')}</span>
+ <span className="text-end">{localize('com_ui_trace_column_duration')}</span>
+ <span className="hidden text-end md:block">{localize('com_ui_trace_column_tokens')}</span>
{showCost && (
- <span className="hidden text-right md:block">
- {localize('com_ui_trace_summary_cost')}
- </span>
+ <span className="hidden text-end md:block">{localize('com_ui_trace_summary_cost')}</span>
)}
{viewDomain ? (
- <span className="flex justify-between tracking-normal normal-case tabular-nums">
+ <span dir="ltr" className="flex justify-between tracking-normal normal-case tabular-nums">
<span>{position(viewDomain.start)}</span>
<span>{position(viewDomain.start + viewDomain.span)}</span>
</span>
diff --git a/client/src/components/Chat/Trace/Timeline.tsx b/client/src/components/Chat/Trace/Timeline.tsx
index e0e818fbe1..845485fe1e 100644
--- a/client/src/components/Chat/Trace/Timeline.tsx
+++ b/client/src/components/Chat/Trace/Timeline.tsx
@@ -216,6 +216,7 @@ function Timeline({
aria-label={localize('com_ui_trace_overview')}
aria-describedby={hintId}
data-testid="trace-overview"
+ dir="ltr"
data-scale={scale}
onKeyDown={handleKeyDown}
onPointerDown={handlePointerDown}
@@ -259,6 +260,7 @@ function Timeline({
)}
</div>
<div
+ dir="ltr"
className="text-text-secondary text-2xs flex justify-between tabular-nums"
aria-hidden="true"
>
diff --git a/client/src/components/Chat/Trace/Viewer.tsx b/client/src/components/Chat/Trace/Viewer.tsx
index 84162078d3..bc0fba171b 100644
--- a/client/src/components/Chat/Trace/Viewer.tsx
+++ b/client/src/components/Chat/Trace/Viewer.tsx
@@ -486,7 +486,7 @@ export default function Viewer({
<Layers className="size-4" aria-hidden="true" />
<span className="hidden sm:inline">{localize('com_ui_trace_all_spans')}</span>
</Button>
- <div className="ml-auto flex items-center gap-1">
+ <div className="ms-auto flex items-center gap-1">
{view != null && (
<span className="text-text-secondary text-xs tabular-nums" aria-live="polite">
{selectionText()}
@@ -612,7 +612,7 @@ export default function Viewer({
<h2 id={headingId} className="text-base font-semibold">
{localize('com_ui_trace_title')}
</h2>
- <div className="ml-auto flex items-center gap-2">
+ <div className="ms-auto flex items-center gap-2">
{langfuseUrl != null && (
<a
href={langfuseUrl}
diff --git a/client/src/components/Chat/Trace/__tests__/Viewer.test.tsx b/client/src/components/Chat/Trace/__tests__/Viewer.test.tsx
index ab16aa7be5..76537a60c1 100644
--- a/client/src/components/Chat/Trace/__tests__/Viewer.test.tsx
+++ b/client/src/components/Chat/Trace/__tests__/Viewer.test.tsx
@@ -512,6 +512,26 @@ describe('Trace Viewer', () => {
expect(screen.getByTestId('trace-inspector')).toBeInTheDocument();
});
+ it('swaps the fold arrows when the tree runs right to left', async () => {
+ renderViewer();
+ await recordRow('llm');
+ const tree = screen.getByRole('tree');
+ tree.style.direction = 'rtl';
+
+ await userEvent.click(stepRow(1));
+ await waitFor(() =>
+ expect(screen.queryByRole('treeitem', { name: recordName('llm') })).not.toBeInTheDocument(),
+ );
+ expect(stepRow(1)).toHaveAttribute('aria-expanded', 'false');
+
+ fireEvent.keyDown(tree, { key: 'ArrowLeft' });
+ expect(await recordRow('llm')).toBeInTheDocument();
+ expect(stepRow(1)).toHaveAttribute('aria-expanded', 'true');
+ fireEvent.keyDown(tree, { key: 'ArrowDown' });
+ fireEvent.keyDown(tree, { key: 'ArrowRight' });
+ expect(tree).toHaveAttribute('aria-activedescendant', stepRow(1).id);
+ });
+
it('keeps the active row mounted while the ledger scrolls away from it', async () => {
const many = [
record({
diff --git a/client/src/components/Chat/approval/Review.tsx b/client/src/components/Chat/approval/Review.tsx
index 9cb84e6785..a4f5351ca0 100644
--- a/client/src/components/Chat/approval/Review.tsx
+++ b/client/src/components/Chat/approval/Review.tsx
@@ -168,7 +168,7 @@ export const PendingToolApprovalPanel = memo(function PendingToolApprovalPanel({
/>
) : (
<p className="text-text-warning mt-2 flex items-center text-xs" role="alert">
- <TriangleAlert className="mr-1.5 size-4" aria-hidden="true" />
+ <TriangleAlert className="me-1.5 size-4" aria-hidden="true" />
{localize('com_ui_approval_unavailable')}
</p>
)}
@@ -185,7 +185,7 @@ export const PendingToolApprovalPanel = memo(function PendingToolApprovalPanel({
<div className="flex items-center gap-2">
{(status === 'expired' || status === 'error') && (
<span className="text-text-warning flex items-center text-xs" role="alert">
- <TriangleAlert className="mr-1.5 size-4" aria-hidden="true" />
+ <TriangleAlert className="me-1.5 size-4" aria-hidden="true" />
{localize(
status === 'expired' ? 'com_ui_approval_expired' : 'com_ui_approval_error',
)}
diff --git a/client/src/components/Messages/Content/ActionButton.tsx b/client/src/components/Messages/Content/ActionButton.tsx
index c43846e30b..5080f68606 100644
--- a/client/src/components/Messages/Content/ActionButton.tsx
+++ b/client/src/components/Messages/Content/ActionButton.tsx
@@ -48,7 +48,7 @@ const ActionButton = React.forwardRef<HTMLButtonElement, ActionButtonProps>(
'hover:bg-surface-hover hover:text-text-primary',
'disabled:pointer-events-none disabled:opacity-50',
'focus-visible:outline-focus-subtle focus-visible:outline focus-visible:outline-2',
- iconOnly ? 'rounded-lg p-1.5' : 'ml-auto gap-2 rounded-md px-2 py-1',
+ iconOnly ? 'rounded-lg p-1.5' : 'ms-auto gap-2 rounded-md px-2 py-1',
className,
)}
>
diff --git a/client/src/components/Messages/Content/CodeBar.tsx b/client/src/components/Messages/Content/CodeBar.tsx
index 7576fb8dfc..306b59e3bc 100644
--- a/client/src/components/Messages/Content/CodeBar.tsx
+++ b/client/src/components/Messages/Content/CodeBar.tsx
@@ -22,7 +22,7 @@ const CodeBar: React.FC<CodeBarProps> = React.memo(
{lang}
</span>
{plugin === true ? (
- <InfoIcon className="text-text-secondary ml-auto flex h-4 w-4 gap-2" />
+ <InfoIcon className="text-text-secondary ms-auto flex h-4 w-4 gap-2" />
) : (
<div className="flex items-center justify-center gap-2">
{allowExecution === true && (
diff --git a/client/src/components/Messages/Content/CodeBlock.tsx b/client/src/components/Messages/Content/CodeBlock.tsx
index 73758521b1..0aea0bad83 100644
--- a/client/src/components/Messages/Content/CodeBlock.tsx
+++ b/client/src/components/Messages/Content/CodeBlock.tsx
@@ -117,7 +117,7 @@ const CodeBlock: React.FC<CodeBlockProps> = ({
allowExecution={allowExecution}
/>
</div>
- <div className={cn(classProp, 'bg-surface-code-body overflow-y-auto p-4')}>
+ <div dir="ltr" className={cn(classProp, 'bg-surface-code-body overflow-y-auto p-4')}>
<code
ref={codeRef}
className={cn(
@@ -138,7 +138,7 @@ const CodeBlock: React.FC<CodeBlockProps> = ({
/>
{allowExecution === true && toolCalls && toolCalls.length > 0 && (
<>
- <div className="border-border-inset bg-surface-code border-t p-4 text-xs">
+ <div dir="ltr" className="border-border-inset bg-surface-code border-t p-4 text-xs">
<div className="text-text-secondary text-3xs mb-1 font-medium tracking-wide uppercase">
{localize('com_ui_output')}
</div>
diff --git a/client/src/components/Messages/Content/Error/parts.tsx b/client/src/components/Messages/Content/Error/parts.tsx
index 9c58841f8d..fbff489c2f 100644
--- a/client/src/components/Messages/Content/Error/parts.tsx
+++ b/client/src/components/Messages/Content/Error/parts.tsx
@@ -283,7 +283,7 @@ export function ErrorDetails({ label, children }: { label: string; children: Rea
<ChevronRight
className={cn(
'size-3.5 transition-transform duration-300 [transition-timing-function:cubic-bezier(0.16,1,0.3,1)] motion-reduce:transition-none',
- open && 'rotate-90',
+ open ? 'rotate-90' : 'rtl:-scale-x-100',
)}
aria-hidden="true"
/>
diff --git a/client/src/components/Messages/Content/FloatingCodeBar.tsx b/client/src/components/Messages/Content/FloatingCodeBar.tsx
index 08995c0383..fc7a5f41a9 100644
--- a/client/src/components/Messages/Content/FloatingCodeBar.tsx
+++ b/client/src/components/Messages/Content/FloatingCodeBar.tsx
@@ -24,12 +24,12 @@ const FloatingCodeBar: React.FC<FloatingCodeBarProps> = React.memo(
return (
<div
className={cn(
- 'absolute bottom-2 right-2 flex items-center gap-2 font-sans text-xs text-text-secondary transition-opacity duration-150',
+ 'text-text-secondary absolute inset-e-2 bottom-2 flex items-center gap-2 font-sans text-xs transition-opacity duration-150',
isVisible ? 'opacity-100' : 'pointer-events-none opacity-0',
)}
>
{plugin === true ? (
- <InfoIcon className="flex h-4 w-4 gap-2 text-text-secondary" />
+ <InfoIcon className="text-text-secondary flex h-4 w-4 gap-2" />
) : (
<>
{allowExecution === true && (
diff --git a/client/src/components/Messages/Content/Mermaid/Export.tsx b/client/src/components/Messages/Content/Mermaid/Export.tsx
index 3bbf22c56b..25e394301d 100644
--- a/client/src/components/Messages/Content/Mermaid/Export.tsx
+++ b/client/src/components/Messages/Content/Mermaid/Export.tsx
@@ -229,7 +229,7 @@ const MermaidExport = memo(function MermaidExport({
setIsOpen={setIsOpen}
items={dropdownItems}
portalElement={portalElement}
- className="absolute top-0 right-0 mt-2 motion-reduce:!transition-none"
+ className="absolute inset-e-0 top-0 mt-2 motion-reduce:!transition-none"
minWidth="13rem"
trigger={
<TooltipAnchor
diff --git a/client/src/components/Messages/Content/Mermaid/Mermaid.tsx b/client/src/components/Messages/Content/Mermaid/Mermaid.tsx
index 45bdfa6a2e..c19b60d9aa 100644
--- a/client/src/components/Messages/Content/Mermaid/Mermaid.tsx
+++ b/client/src/components/Messages/Content/Mermaid/Mermaid.tsx
@@ -362,7 +362,7 @@ export const MermaidRenderer = memo(function MermaidRenderer({
data-testid={fillContainer ? 'mermaid-artifact-canvas' : undefined}
onMouseDown={handleMouseDown}
>
- <div className="border-border-light bg-surface-secondary text-text-secondary absolute top-2 left-2 z-10 flex items-center gap-1 rounded border px-2 py-1 text-xs">
+ <div className="border-border-light bg-surface-secondary text-text-secondary absolute inset-s-2 top-2 z-10 flex items-center gap-1 rounded border px-2 py-1 text-xs">
<Spinner className="h-3 w-3" />
</div>
<div
@@ -388,7 +388,7 @@ export const MermaidRenderer = memo(function MermaidRenderer({
onZoomOut={handleZoomOut}
onReset={handleResetZoom}
className={cn(
- 'absolute right-2 bottom-2 z-10 transition-opacity duration-200',
+ 'absolute inset-e-2 bottom-2 z-10 transition-opacity duration-200',
showControls ? 'opacity-100' : 'pointer-events-none opacity-0',
)}
/>
@@ -558,7 +558,7 @@ export const MermaidRenderer = memo(function MermaidRenderer({
onZoomOut={handleZoomOut}
onReset={handleResetZoom}
className={cn(
- 'absolute right-2 bottom-2 z-10 transition-opacity duration-200',
+ 'absolute inset-e-2 bottom-2 z-10 transition-opacity duration-200',
showControls ? 'opacity-100' : 'pointer-events-none opacity-0',
)}
/>
diff --git a/client/src/components/Messages/Content/Mermaid/MermaidDialog.tsx b/client/src/components/Messages/Content/Mermaid/MermaidDialog.tsx
index 14007398b2..0a71361af1 100644
--- a/client/src/components/Messages/Content/Mermaid/MermaidDialog.tsx
+++ b/client/src/components/Messages/Content/Mermaid/MermaidDialog.tsx
@@ -167,7 +167,7 @@ const MermaidDialog: React.FC<MermaidDialogProps> = memo(
onZoomIn={handleZoomIn}
onZoomOut={handleZoomOut}
onReset={handleResetZoom}
- className="absolute right-4 bottom-4 z-10"
+ className="absolute inset-e-4 bottom-4 z-10"
/>
</div>
</OGDialogContent>
diff --git a/client/src/components/Messages/Content/ResultSwitcher.tsx b/client/src/components/Messages/Content/ResultSwitcher.tsx
index 8e02f1bc3d..6d38ad7f02 100644
--- a/client/src/components/Messages/Content/ResultSwitcher.tsx
+++ b/client/src/components/Messages/Content/ResultSwitcher.tsx
@@ -35,10 +35,12 @@ export default function ResultSwitcher({
aria-label={localize('com_ui_prev_result')}
className="text-text-tertiary hover:bg-surface-hover hover:text-text-primary focus:outline-focus-subtle rounded p-0.5 transition-colors focus:outline focus:outline-2 disabled:pointer-events-none disabled:opacity-30"
>
- <ChevronLeft className="size-3.5" aria-hidden="true" />
+ <ChevronLeft className="size-3.5 rtl:-scale-x-100" aria-hidden="true" />
</button>
<span className="text-text-secondary min-w-[3ch] text-center tabular-nums select-none">
- {currentIndex + 1}/{totalCount}
+ <bdi>
+ {currentIndex + 1}/{totalCount}
+ </bdi>
</span>
<button
type="button"
@@ -47,7 +49,7 @@ export default function ResultSwitcher({
aria-label={localize('com_ui_next_result')}
className="text-text-tertiary hover:bg-surface-hover hover:text-text-primary focus:outline-focus-subtle rounded p-0.5 transition-colors focus:outline focus:outline-2 disabled:pointer-events-none disabled:opacity-30"
>
- <ChevronRight className="size-3.5" aria-hidden="true" />
+ <ChevronRight className="size-3.5 rtl:-scale-x-100" aria-hidden="true" />
</button>
</nav>
);
diff --git a/client/src/components/Messages/Content/RunCode.tsx b/client/src/components/Messages/Content/RunCode.tsx
index 347baa5601..3a1d610ff2 100644
--- a/client/src/components/Messages/Content/RunCode.tsx
+++ b/client/src/components/Messages/Content/RunCode.tsx
@@ -113,7 +113,7 @@ const RunCode: React.FC<CodeBarProps & { iconOnly?: boolean }> = React.memo(
isError && 'text-text-destructive hover:text-text-destructive',
iconOnly
? 'rounded-lg p-1.5'
- : 'ml-auto gap-2 rounded-lg p-1.5 md:rounded-md md:px-2 md:py-1',
+ : 'ms-auto gap-2 rounded-lg p-1.5 md:rounded-md md:px-2 md:py-1',
)}
>
<span
diff --git a/client/src/components/Messages/ScrollToBottom.tsx b/client/src/components/Messages/ScrollToBottom.tsx
index 4ccd3d2f15..1da1ca69c6 100644
--- a/client/src/components/Messages/ScrollToBottom.tsx
+++ b/client/src/components/Messages/ScrollToBottom.tsx
@@ -37,7 +37,7 @@ const ScrollToBottom = forwardRef<HTMLDivElement, Props>(
>
{/* The composer's own column, so the control stacks over the send
button one row down: the same end inset (`me-2`, mirroring Send's
- `mr-2`) and, through `icon-theme` + `round`, the same control
+ `me-2`) and, through `icon-theme` + `round`, the same control
geometry as every button in the composer's action row. */}
<div
className={cn(
diff --git a/client/src/components/Web/Citation.tsx b/client/src/components/Web/Citation.tsx
index d80c0348c7..a70b4d13e6 100644
--- a/client/src/components/Web/Citation.tsx
+++ b/client/src/components/Web/Citation.tsx
@@ -130,10 +130,10 @@ export function CompositeCitation(props: CompositeCitationProps) {
{isFileType ? (
<>
<div className="flex items-center gap-2">
- <FileText className="size-4 shrink-0 text-text-secondary" aria-hidden="true" />
+ <FileText className="text-text-secondary size-4 shrink-0" aria-hidden="true" />
<button
onClick={handleFileClick}
- className="min-w-0 truncate text-sm font-medium text-text-primary hover:underline"
+ className="text-text-primary min-w-0 truncate text-sm font-medium hover:underline"
>
{fileName || currentSource.title || localize('com_file_source')}
</button>
@@ -141,24 +141,24 @@ export function CompositeCitation(props: CompositeCitationProps) {
{(fileRelevance != null || (filePages && filePages.length > 0)) && (
<div className="mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1">
{fileRelevance != null && fileRelevance > 0 && (
- <span className="text-xs text-text-secondary">
+ <span className="text-text-secondary text-xs">
{localize('com_ui_relevance')}: {Math.round(fileRelevance * 100)}%
</span>
)}
{filePages && filePages.length > 0 && (
- <span className="text-xs text-text-secondary">
+ <span className="text-text-secondary text-xs">
{localize('com_file_pages', { pages: filePages.join(', ') })}
</span>
)}
</div>
)}
{currentSource.snippet && (
- <p className="mt-1.5 line-clamp-3 break-words text-xs leading-relaxed text-text-secondary">
+ <p className="text-text-secondary mt-1.5 line-clamp-3 text-xs leading-relaxed break-words">
{currentSource.snippet}
</p>
)}
{totalPages > 1 && (
- <div className="mt-2 flex items-center gap-1 border-t border-border-light pt-2">
+ <div className="border-border-light mt-2 flex items-center gap-1 border-t pt-2">
<Button
size="icon"
variant="ghost"
@@ -167,7 +167,7 @@ export function CompositeCitation(props: CompositeCitationProps) {
className="size-7"
aria-label="Previous source"
>
- <ChevronLeft className="size-3.5" aria-hidden="true" />
+ <ChevronLeft className="size-3.5 rtl:-scale-x-100" aria-hidden="true" />
</Button>
{sources.map((source, i) => (
<button
@@ -180,7 +180,7 @@ export function CompositeCitation(props: CompositeCitationProps) {
}}
className={`flex size-6 items-center justify-center rounded text-xs transition-colors ${
i === currentPage
- ? 'bg-surface-hover font-medium text-text-primary'
+ ? 'bg-surface-hover text-text-primary font-medium'
: 'text-text-secondary hover:bg-surface-hover'
}`}
aria-label={`Source ${i + 1}`}
@@ -197,7 +197,7 @@ export function CompositeCitation(props: CompositeCitationProps) {
className="size-7"
aria-label="Next source"
>
- <ChevronRight className="size-3.5" aria-hidden="true" />
+ <ChevronRight className="size-3.5 rtl:-scale-x-100" aria-hidden="true" />
</Button>
</div>
)}
@@ -207,27 +207,27 @@ export function CompositeCitation(props: CompositeCitationProps) {
<div className="mb-1.5 overflow-hidden text-sm">
<FaviconImage
domain={getCleanDomain(currentSource.link || '')}
- className="float-left mr-2 mt-0.5"
+ className="float-start me-2 mt-0.5"
/>
- <span className="float-right ml-2 max-w-[40%] truncate text-xs text-text-secondary">
+ <span className="text-text-secondary float-end ms-2 max-w-[40%] truncate text-xs">
{getCleanDomain(currentSource.link || '')}
</span>
<a
href={currentSource.link}
target="_blank"
rel="noopener noreferrer"
- className="font-medium text-text-primary hover:underline"
+ className="text-text-primary font-medium hover:underline"
>
{currentSource.title}
</a>
</div>
{currentSource.snippet && (
- <p className="line-clamp-4 break-words text-xs text-text-secondary md:text-sm">
+ <p className="text-text-secondary line-clamp-4 text-xs break-words md:text-sm">
{currentSource.snippet}
</p>
)}
{totalPages > 1 && (
- <div className="flex items-center gap-1 border-t border-border-light pt-2">
+ <div className="border-border-light flex items-center gap-1 border-t pt-2">
<Button
size="icon"
variant="ghost"
@@ -236,7 +236,7 @@ export function CompositeCitation(props: CompositeCitationProps) {
className="size-7"
aria-label="Previous source"
>
- <ChevronLeft className="size-3.5" aria-hidden="true" />
+ <ChevronLeft className="size-3.5 rtl:-scale-x-100" aria-hidden="true" />
</Button>
{sources.map((source, i) => (
<button
@@ -249,7 +249,7 @@ export function CompositeCitation(props: CompositeCitationProps) {
}}
className={`flex size-6 items-center justify-center rounded text-xs transition-colors ${
i === currentPage
- ? 'bg-surface-hover font-medium text-text-primary'
+ ? 'bg-surface-hover text-text-primary font-medium'
: 'text-text-secondary hover:bg-surface-hover'
}`}
aria-label={`Source ${i + 1}`}
@@ -266,7 +266,7 @@ export function CompositeCitation(props: CompositeCitationProps) {
className="size-7"
aria-label="Next source"
>
- <ChevronRight className="size-3.5" aria-hidden="true" />
+ <ChevronRight className="size-3.5 rtl:-scale-x-100" aria-hidden="true" />
</Button>
</div>
)}
diff --git a/client/src/components/Web/SourceHovercard.tsx b/client/src/components/Web/SourceHovercard.tsx
index 89a7fa24a9..756d5b99d5 100644
--- a/client/src/components/Web/SourceHovercard.tsx
+++ b/client/src/components/Web/SourceHovercard.tsx
@@ -128,7 +128,7 @@ export function SourceHovercard({
);
return (
- <span className="relative ml-0.5 inline-block">
+ <span className="relative ms-0.5 inline-block">
<Ariakit.HovercardProvider store={hovercard}>
<span className="flex items-center">
<Ariakit.HovercardAnchor
@@ -136,7 +136,7 @@ export function SourceHovercard({
isFile ? (
<button
onClick={handleFileClick}
- className="border-border-heavy bg-surface-secondary text-text-primary hover:bg-surface-hover ml-1 inline-flex h-5 max-w-36 items-center gap-1 overflow-hidden rounded-xl border px-2 text-xs font-medium text-ellipsis whitespace-nowrap no-underline transition-colors"
+ className="border-border-heavy bg-surface-secondary text-text-primary hover:bg-surface-hover ms-1 inline-flex h-5 max-w-36 items-center gap-1 overflow-hidden rounded-xl border px-2 text-xs font-medium text-ellipsis whitespace-nowrap no-underline transition-colors"
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
title={
@@ -151,7 +151,7 @@ export function SourceHovercard({
href={source.link}
target="_blank"
rel="noopener noreferrer"
- className="border-border-heavy bg-surface-secondary hover:bg-surface-hover ml-1 inline-block h-5 max-w-36 cursor-pointer items-center overflow-hidden rounded-xl border px-2 text-xs font-medium text-ellipsis whitespace-nowrap no-underline transition-colors"
+ className="border-border-heavy bg-surface-secondary hover:bg-surface-hover ms-1 inline-block h-5 max-w-36 cursor-pointer items-center overflow-hidden rounded-xl border px-2 text-xs font-medium text-ellipsis whitespace-nowrap no-underline transition-colors"
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
>
@@ -160,7 +160,7 @@ export function SourceHovercard({
)
}
/>
- <Ariakit.HovercardDisclosure className="text-text-primary focus:ring-text-primary ml-0.5 rounded-full focus:ring-2 focus:outline-hidden">
+ <Ariakit.HovercardDisclosure className="text-text-primary focus:ring-text-primary ms-0.5 rounded-full focus:ring-2 focus:outline-hidden">
<VisuallyHidden>{localize('com_citation_more_details', { label })}</VisuallyHidden>
<ChevronDown className="icon-sm" aria-hidden="true" />
</Ariakit.HovercardDisclosure>
@@ -183,8 +183,8 @@ export function SourceHovercard({
) : (
<>
<div className="mb-1.5 overflow-hidden text-sm">
- <FaviconImage domain={domain} className="float-left mt-0.5 mr-2" />
- <span className="text-text-secondary float-right ml-2 max-w-[40%] truncate text-xs">
+ <FaviconImage domain={domain} className="float-start me-2 mt-0.5" />
+ <span className="text-text-secondary float-end ms-2 max-w-[40%] truncate text-xs">
{domain}
</span>
<a
diff --git a/client/src/components/Web/Sources.tsx b/client/src/components/Web/Sources.tsx
index 201a6965ff..fa0ad75e99 100644
--- a/client/src/components/Web/Sources.tsx
+++ b/client/src/components/Web/Sources.tsx
@@ -82,7 +82,7 @@ function SourceItem({ source, expanded = false }: SourceItemProps) {
</a>
}
/>
- <Ariakit.HovercardDisclosure className="text-text-primary focus:ring-text-primary absolute right-2 rounded-full focus:ring-2 focus:outline-hidden">
+ <Ariakit.HovercardDisclosure className="text-text-primary focus:ring-text-primary absolute inset-e-2 rounded-full focus:ring-2 focus:outline-hidden">
<VisuallyHidden>
{localize('com_citation_more_details', { label: domain })}
</VisuallyHidden>
@@ -103,8 +103,8 @@ function SourceItem({ source, expanded = false }: SourceItemProps) {
<div className="flex gap-3">
<div className="min-w-0 flex-1">
<div className="mb-1.5 overflow-hidden text-sm">
- <FaviconImage domain={domain} className="float-left mt-0.5 mr-2" />
- <span className="text-text-secondary float-right ml-2 max-w-[40%] truncate text-xs">
+ <FaviconImage domain={domain} className="float-start me-2 mt-0.5" />
+ <span className="text-text-secondary float-end ms-2 max-w-[40%] truncate text-xs">
{domain}
</span>
<a
@@ -302,14 +302,14 @@ const FileItem = React.memo(function FileItem({
<span className="text-text-secondary truncate text-xs font-medium">
{localize('com_sources_agent_file')}
</span>
- {!isLocalFile && <Download className="ml-auto size-3" aria-hidden="true" />}
+ {!isLocalFile && <Download className="ms-auto size-3" aria-hidden="true" />}
</div>
<div className="mt-1 min-w-0">
- <span className="text-text-primary line-clamp-2 text-left text-sm font-medium break-words md:line-clamp-3">
+ <span className="text-text-primary line-clamp-2 text-start text-sm font-medium break-words md:line-clamp-3">
{file.filename}
</span>
{file.pages && file.pages.length > 0 && (
- <span className="text-text-secondary mt-1 line-clamp-1 text-left text-xs">
+ <span className="text-text-secondary mt-1 line-clamp-1 text-start text-xs">
{localize('com_sources_pages')}:{' '}
{sortPagesByRelevance(file.pages, file.pageRelevance).join(', ')}
</span>
@@ -343,14 +343,14 @@ const FileItem = React.memo(function FileItem({
<span className="text-text-secondary truncate text-xs font-medium">
{localize('com_sources_agent_file')}
</span>
- {!isLocalFile && <Download className="ml-auto size-3" aria-hidden="true" />}
+ {!isLocalFile && <Download className="ms-auto size-3" aria-hidden="true" />}
</div>
<div className="mt-1 min-w-0">
- <span className="text-text-primary line-clamp-2 text-left text-sm font-medium break-words md:line-clamp-3">
+ <span className="text-text-primary line-clamp-2 text-start text-sm font-medium break-words md:line-clamp-3">
{file.filename}
</span>
{file.pages && file.pages.length > 0 && (
- <span className="text-text-secondary mt-1 line-clamp-1 text-left text-xs">
+ <span className="text-text-secondary mt-1 line-clamp-1 text-start text-xs">
{localize('com_sources_pages')}:{' '}
{sortPagesByRelevance(file.pages, file.pageRelevance).join(', ')}
</span>
@@ -380,7 +380,7 @@ export function StackedFavicons({
<FaviconImage
key={`icon-${i}`}
domain={getCleanDomain(source.link)}
- className={i > 0 ? 'ml-[-0.375rem]' : ''}
+ className={i > 0 ? 'ms-[-0.375rem]' : ''}
/>
))}
</div>
@@ -511,7 +511,7 @@ function FilesGroup({ files, messageId, conversationId, limit = 3 }: FilesGroupP
{remainingFiles.slice(0, 3).map((_, i) => (
<File
key={`file-icon-${i}`}
- className={`size-4 ${i > 0 ? 'ml-[-0.375rem]' : ''}`}
+ className={`size-4 ${i > 0 ? 'ms-[-0.375rem]' : ''}`}
/>
))}
</div>
diff --git a/client/src/mobile.css b/client/src/mobile.css
index 14e0716ffe..aae757ca94 100644
--- a/client/src/mobile.css
+++ b/client/src/mobile.css
@@ -21,7 +21,7 @@
.nav.active {
position: relative;
- left: 0;
+ inset-inline-start: 0;
opacity: 1;
}
diff --git a/client/src/style.css b/client/src/style.css
index b3efd7a164..f7760c35a8 100644
--- a/client/src/style.css
+++ b/client/src/style.css
@@ -129,6 +129,14 @@ html {
* variables and hard-coded literals elsewhere in this stylesheet. Every ratio
* quoted below is measured against the mode's own canvas, pure white or pure
* black. */
+/* +1 in LTR, -1 in RTL: lets a keyframe mirror its horizontal travel. */
+:root {
+ --dir-sign: 1;
+}
+[dir='rtl'] {
+ --dir-sign: -1;
+}
+
html.high-contrast {
/* A 0.5rem bar is a small target to hit and a thin thing to see. */
--scrollbar-size: 0.75rem;
@@ -338,7 +346,7 @@ html.high-contrast.dark .btn-neutral:hover {
background-position: right 0.5rem center;
background-repeat: no-repeat;
background-size: 1.5em 1.5em;
- padding-right: 2.5rem;
+ padding-inline-end: 2.5rem;
background-color: rgb(var(--select-fill));
border-color: rgb(var(--select-edge));
border-radius: 0;
@@ -346,6 +354,9 @@ html.high-contrast.dark .btn-neutral:hover {
font-size: 1rem;
line-height: 1.5rem;
}
+ [dir='rtl'] select {
+ background-position: left 0.5rem center;
+ }
}
p > small {
@@ -522,15 +533,15 @@ p > small {
margin-top: 0.8em;
}
.prose :where(blockquote):not(:where([class~='not-prose'] *)) {
- border-left-color: var(--tw-prose-quote-borders);
- border-left-width: 0.25rem;
+ border-inline-start-color: var(--tw-prose-quote-borders);
+ border-inline-start-width: 0.25rem;
color: var(--tw-prose-quotes);
font-style: italic;
font-style: normal;
font-weight: 500;
margin-bottom: 1.6em;
margin-top: 1.6em;
- padding-left: 1em;
+ padding-inline-start: 1em;
quotes: '\201C' '\201D' '\2018' '\2019';
}
.prose :where(blockquote p:first-of-type):not(:where([class~='not-prose'] *)):before {
@@ -608,6 +619,14 @@ p > small {
padding: 0.125rem 0.25rem;
border-radius: 0.35rem;
}
+.prose :where(code):not(:where([class~='not-prose'] *, pre *)) {
+ direction: ltr;
+ unicode-bidi: isolate;
+}
+.katex,
+.katex-display {
+ direction: ltr;
+}
.prose :where(a code):not(:where([class~='not-prose'] *)) {
color: inherit;
}
@@ -665,7 +684,7 @@ p > small {
margin-bottom: 2em;
margin-top: 2em;
table-layout: auto;
- text-align: left;
+ text-align: start;
width: 100%;
}
.prose :where(thead):not(:where([class~='not-prose'] *)) {
@@ -676,8 +695,8 @@ p > small {
color: var(--tw-prose-headings);
font-weight: 600;
padding-bottom: 0.5714286em;
- padding-left: 0.5714286em;
- padding-right: 0.5714286em;
+ padding-inline-start: 0.5714286em;
+ padding-inline-end: 0.5714286em;
vertical-align: bottom;
}
.prose :where(tbody tr):not(:where([class~='not-prose'] *)) {
@@ -754,7 +773,7 @@ p > small {
margin-top: 0.5em;
}
.prose :where(ul > li):not(:where([class~='not-prose'] *)) {
- padding-left: 0.375em;
+ padding-inline-start: 0.375em;
}
.prose :where(.prose > ul > li p):not(:where([class~='not-prose'] *)) {
margin-bottom: 0.75em;
@@ -786,19 +805,19 @@ p > small {
margin-top: 0.4em;
}
.prose :where(thead th:first-child):not(:where([class~='not-prose'] *)) {
- padding-left: 0;
+ padding-inline-start: 0;
}
.prose :where(thead th:last-child):not(:where([class~='not-prose'] *)) {
- padding-right: 0;
+ padding-inline-end: 0;
}
.prose :where(tbody td, tfoot td):not(:where([class~='not-prose'] *)) {
padding: 0.5714286em;
}
.prose :where(tbody td:first-child, tfoot td:first-child):not(:where([class~='not-prose'] *)) {
- padding-left: 0;
+ padding-inline-start: 0;
}
.prose :where(tbody td:last-child, tfoot td:last-child):not(:where([class~='not-prose'] *)) {
- padding-right: 0;
+ padding-inline-end: 0;
}
.prose :where(.prose > :first-child):not(:where([class~='not-prose'] *)) {
margin-top: 0;
@@ -845,6 +864,8 @@ code.language-md {
code.hljs,
code[class*='language-'],
pre[class*='language-'] {
+ direction: ltr;
+ unicode-bidi: isolate;
word-wrap: normal;
background: none;
color: rgb(var(--syntax-text));
@@ -1130,9 +1151,9 @@ html[data-drawer-nav] body {
.markdown blockquote {
--tw-border-opacity: 1;
border-color: rgb(var(--prose-quote-bar));
- border-left-width: 2px;
+ border-inline-start-width: 2px;
line-height: 1rem;
- padding-left: 1rem;
+ padding-inline-start: 1rem;
}
.markdown table {
@@ -1146,37 +1167,37 @@ html[data-drawer-nav] body {
.markdown th {
background-color: rgb(var(--table-header-fill));
border-bottom-width: 1px;
- border-left-width: 1px;
+ border-inline-start-width: 1px;
border-top-width: 1px;
padding: 0.25rem 0.75rem;
}
.markdown th:first-child {
- border-top-left-radius: 0.375rem;
+ border-start-start-radius: 0.375rem;
}
.markdown th:last-child {
- border-right-width: 1px;
+ border-inline-end-width: 1px;
border-color: rgb(var(--border-medium));
- border-top-right-radius: 0.375rem;
+ border-start-end-radius: 0.375rem;
}
.markdown td {
border-bottom-width: 1px;
- border-left-width: 1px;
+ border-inline-start-width: 1px;
padding: 0.25rem 0.75rem;
}
.markdown td:last-child {
- border-right-width: 1px;
+ border-inline-end-width: 1px;
}
.markdown tbody tr:last-child td:first-child {
- border-bottom-left-radius: 0.375rem;
+ border-end-start-radius: 0.375rem;
}
.markdown tbody tr:last-child td:last-child {
- border-bottom-right-radius: 0.375rem;
+ border-end-end-radius: 0.375rem;
}
/* The column rules take the inset share of the border-medium edge, so a theme that draws no inset
@@ -1186,10 +1207,10 @@ html[data-drawer-nav] body {
* edge that is visually outermost with no selector on direction. The selectors outrank the cell
* rules above, which restate the edge in one declaration, and leave high contrast to its own. */
html:not(.high-contrast) .markdown :is(th, td) {
- border-left-color: rgb(
+ border-inline-start-color: rgb(
var(--border-medium) / calc(var(--border-medium-alpha, 1) * var(--theme-border-inset-alpha, 1))
);
- border-right-color: rgb(
+ border-inline-end-color: rgb(
var(--border-medium) / calc(var(--border-medium-alpha, 1) * var(--theme-border-inset-alpha, 1))
);
}
@@ -1283,9 +1304,9 @@ html {
.markdown blockquote {
--tw-border-opacity: 1;
border-color: rgb(var(--prose-quote-bar));
- border-left-width: 2px;
+ border-inline-start-width: 2px;
line-height: 1rem;
- padding-left: 1rem;
+ padding-inline-start: 1rem;
}
.markdown table {
--tw-border-spacing-x: 0px;
@@ -1299,34 +1320,34 @@ html {
background-color: rgb(var(--table-header-fill));
color: rgb(var(--table-header-text));
border-bottom-width: 1px;
- border-left-width: 1px;
+ border-inline-start-width: 1px;
border-top-width: 1px;
border-color: rgb(var(--border-medium));
padding: 0.25rem 0.75rem;
font-weight: 600;
}
.markdown th:first-child {
- border-top-left-radius: var(--theme-control-radius, 0.75rem);
+ border-start-start-radius: var(--theme-control-radius, 0.75rem);
}
.markdown th:last-child {
- border-right-width: 1px;
- border-top-right-radius: var(--theme-control-radius, 0.75rem);
+ border-inline-end-width: 1px;
+ border-start-end-radius: var(--theme-control-radius, 0.75rem);
}
.markdown td {
border-bottom-width: 1px;
- border-left-width: 1px;
+ border-inline-start-width: 1px;
border-color: rgb(var(--border-medium));
padding: 0.25rem 0.75rem;
}
.markdown td:last-child {
- border-right-width: 1px;
+ border-inline-end-width: 1px;
border-color: rgb(var(--border-medium));
}
.markdown tbody tr:last-child td:first-child {
- border-bottom-left-radius: var(--theme-control-radius, 0.75rem);
+ border-end-start-radius: var(--theme-control-radius, 0.75rem);
}
.markdown tbody tr:last-child td:last-child {
- border-bottom-right-radius: var(--theme-control-radius, 0.75rem);
+ border-end-end-radius: var(--theme-control-radius, 0.75rem);
}
.markdown a {
text-decoration-line: underline;
@@ -1525,7 +1546,7 @@ html {
Noto Sans,
sans-serif;
line-height: normal;
- margin-left: 0.25rem;
+ margin-inline-start: 0.25rem;
vertical-align: middle;
font-size: 0.5rem;
}
@@ -1545,7 +1566,7 @@ html {
Noto Sans,
sans-serif;
line-height: normal;
- margin-left: 0.25rem;
+ margin-inline-start: 0.25rem;
vertical-align: middle;
font-size: 0.5rem;
display: inline-block;
@@ -1570,7 +1591,7 @@ html {
Noto Sans,
sans-serif;
line-height: normal;
- margin-left: 0.25rem;
+ margin-inline-start: 0.25rem;
vertical-align: middle;
font-size: 0.5rem;
display: inline-block;
@@ -1669,7 +1690,7 @@ html {
list-style-position: outside;
margin-top: 1em;
margin-bottom: 1em;
- padding-left: 1em;
+ padding-inline-start: 1em;
}
.prose li,
@@ -1687,7 +1708,7 @@ html {
.prose ol > li,
.markdown ol > li {
position: relative;
- padding-left: 0.375em;
+ padding-inline-start: 0.375em;
}
.prose ol > li::marker,
@@ -1715,7 +1736,7 @@ html {
.prose ul > li,
.markdown ul > li {
- padding-left: 0.375em;
+ padding-inline-start: 0.375em;
}
.prose ul > li::marker,
@@ -1878,8 +1899,8 @@ html {
background-color: rgb(var(--surface-tooltip, var(--surface-primary)));
padding-top: var(--theme-tooltip-padding-y, 0.25rem);
padding-bottom: var(--theme-tooltip-padding-y, 0.25rem);
- padding-left: var(--theme-tooltip-padding-x, 0.5rem);
- padding-right: var(--theme-tooltip-padding-x, 0.5rem);
+ padding-inline-start: var(--theme-tooltip-padding-x, 0.5rem);
+ padding-inline-end: var(--theme-tooltip-padding-x, 0.5rem);
font-size: var(--theme-tooltip-text-size, 1rem);
line-height: 1.5;
color: rgb(var(--text-tooltip, var(--text-primary)));
@@ -1988,7 +2009,7 @@ html[data-input-modality='keyboard']
transition-duration: 150ms;
scale: 0.95;
margin-top: 4px;
- margin-right: -2px;
+ margin-inline-end: -2px;
}
.popover-animate {
@@ -2052,6 +2073,15 @@ html[data-input-modality='keyboard']
.popover-ui.popover-from-left[data-enter] {
translate: 0 0;
}
+[dir='rtl'] .popover-ui.popover-from-left,
+.popover-ui.popover-from-left:dir(rtl) {
+ transform-origin: right;
+ translate: 0.5rem 0;
+}
+[dir='rtl'] .popover-ui.popover-from-left[data-enter],
+.popover-ui.popover-from-left[data-enter]:dir(rtl) {
+ translate: 0 0;
+}
.animate-popover-top,
.animate-popover {
@@ -2081,6 +2111,15 @@ html[data-input-modality='keyboard']
opacity: 1;
transform: scale(1) translateX(0);
}
+[dir='rtl'] .animate-popover-left,
+.animate-popover-left:dir(rtl) {
+ transform-origin: right;
+ transform: scale(0.95) translateX(0.5rem);
+}
+[dir='rtl'] .animate-popover-left[data-enter],
+.animate-popover-left[data-enter]:dir(rtl) {
+ transform: scale(1) translateX(0);
+}
/* Corners */
.animate-popover-top-left {
@@ -2095,6 +2134,15 @@ html[data-input-modality='keyboard']
opacity: 1;
transform: scale(1) translate(0, 0);
}
+[dir='rtl'] .animate-popover-top-left,
+.animate-popover-top-left:dir(rtl) {
+ transform-origin: top right;
+ transform: scale(0.95) translate(0.5rem, -0.5rem);
+}
+[dir='rtl'] .animate-popover-top-left[data-enter],
+.animate-popover-top-left[data-enter]:dir(rtl) {
+ transform: scale(1) translate(0, 0);
+}
/**
* Composer popovers. Its own curve rather than `animate-popover`'s: these are
@@ -2400,6 +2448,15 @@ html[data-input-modality='keyboard']
}
}
+@keyframes shimmer-rtl {
+ 0% {
+ background-position: -200% 0;
+ }
+ 100% {
+ background-position: 200% 0;
+ }
+}
+
/* The sweep every in-flight label shares: a running tool call, streaming
reasoning, the elapsed timer. Painted from theme roles rather than fixed
black/white keyed off `.dark`, so a stored or custom theme restates it the
@@ -2424,12 +2481,18 @@ html[data-input-modality='keyboard']
animation: shimmer 4s linear infinite;
}
+[dir='rtl'] .shimmer,
+.shimmer:dir(rtl) {
+ animation-name: shimmer-rtl;
+}
+
/* Halting the animation alone is not a fallback: the background would settle
at position 0 and show only half the sweep, stranding the tail of the label
in the near-invisible dip. Drop the gradient and hand the glyphs back to the
color they would have had. */
@media (prefers-reduced-motion: reduce) {
- .shimmer {
+ .shimmer,
+ [dir='rtl'] .shimmer {
background: none;
animation: none;
-webkit-text-fill-color: currentcolor;
@@ -2463,3 +2526,8 @@ html[data-input-modality='keyboard']
::view-transition-group(chat-form) {
z-index: 2;
}
+
+/* react-virtualized writes an inline `direction: ltr` on its scroll container; only !important beats an inline style, and without it every virtualized list stays LTR in an RTL UI. */
+.ReactVirtualized__Grid {
+ direction: inherit !important;
+}
diff --git a/client/src/utils/__tests__/direction.test.ts b/client/src/utils/__tests__/direction.test.ts
new file mode 100644
index 0000000000..a3cb76b344
--- /dev/null
+++ b/client/src/utils/__tests__/direction.test.ts
@@ -0,0 +1,70 @@
+import { strongDirection } from '../direction';
+
+describe('strongDirection', () => {
+ it('resolves Arabic and Hebrew letters to rtl', () => {
+ expect(strongDirection('\u0645\u0631\u062D\u0628\u0627 hello')).toBe('rtl');
+ expect(strongDirection('\u05E9\u05DC\u05D5\u05DD hello')).toBe('rtl');
+ });
+
+ it('resolves Latin letters to ltr', () => {
+ expect(strongDirection('hello \u0645\u0631\u062D\u0628\u0627')).toBe('ltr');
+ });
+
+ it('treats Devanagari and Thai letters as strong ltr characters', () => {
+ expect(strongDirection('\u0928\u093E\u092E \u0645\u0631\u062D\u0628\u0627')).toBe('ltr');
+ expect(strongDirection('\u0E2A\u0E27\u0E31\u0E2A\u0E14\u0E35 \u05E9\u05DC\u05D5\u05DD')).toBe(
+ 'ltr',
+ );
+ });
+
+ it('treats digits of scripts with their own numerals as strong', () => {
+ expect(strongDirection('\u0967 \u0645\u0631\u062D\u0628\u0627')).toBe('ltr');
+ expect(strongDirection('\u0E51 \u05E9\u05DC\u05D5\u05DD')).toBe('ltr');
+ expect(strongDirection('\u07C1 hello')).toBe('rtl');
+ });
+
+ it('reads strong characters outside letters and digits', () => {
+ expect(strongDirection('\u2160 \u0645\u0631\u062D\u0628\u0627')).toBe('ltr');
+ expect(strongDirection('\u05BE hello')).toBe('rtl');
+ expect(strongDirection('\u061F hello')).toBe('rtl');
+ });
+
+ it('skips combining marks and Arabic separators inside RTL blocks', () => {
+ expect(strongDirection('\u0651 hello')).toBe('ltr');
+ expect(strongDirection('\u060C\u066B hello')).toBe('ltr');
+ });
+
+ it('reads strong symbols outside letter categories', () => {
+ expect(strongDirection('\u{1F1FA}\u{1F1F8} \u0645\u0631\u062D\u0628\u0627')).toBe('ltr');
+ expect(strongDirection('\u2801')).toBe('ltr');
+ expect(strongDirection('\u0964 \u0645\u0631\u062D\u0628\u0627')).toBe('ltr');
+ });
+
+ it('covers scripts added after Unicode 15.1', () => {
+ expect(strongDirection('\u{10D50} hello')).toBe('rtl');
+ });
+
+ it('reads nonspacing marks of bidi class L as strong', () => {
+ expect(strongDirection('\u0CBF \u05E9\u05DC\u05D5\u05DD')).toBe('ltr');
+ expect(strongDirection('\u0651 hello')).toBe('ltr');
+ });
+
+ it('honors explicit direction marks', () => {
+ expect(strongDirection('\u200F hello')).toBe('rtl');
+ expect(strongDirection('\u061C hello')).toBe('rtl');
+ expect(strongDirection('\u200E \u0645\u0631\u062D\u0628\u0627')).toBe('ltr');
+ });
+
+ it('skips digits and punctuation before the first letter', () => {
+ expect(strongDirection('1. \u0661\u0662 (\u0645\u0631\u062D\u0628\u0627)')).toBe('rtl');
+ expect(strongDirection('42 - \u2022 hello')).toBe('ltr');
+ });
+
+ it('returns null when the text has only digits and punctuation', () => {
+ expect(strongDirection('123 \u0661\u0662 \u00D7 ...')).toBeNull();
+ });
+
+ it('returns null for empty input', () => {
+ expect(strongDirection('')).toBeNull();
+ });
+});
diff --git a/client/src/utils/__tests__/subagentContent.test.ts b/client/src/utils/__tests__/subagentContent.test.ts
index 5f1d244701..a3d579ab1f 100644
--- a/client/src/utils/__tests__/subagentContent.test.ts
+++ b/client/src/utils/__tests__/subagentContent.test.ts
@@ -1,6 +1,7 @@
import { ContentTypes } from 'librechat-data-provider';
import type { SubagentUpdateEvent } from 'librechat-data-provider';
import { aggregateSubagentContent, buildSubagentTickerLines } from 'test/subagents';
+import { tailOverflowDirection, textDirection } from '../subagentContent';
const makeEvent = (overrides: Partial<SubagentUpdateEvent>): SubagentUpdateEvent => ({
runId: 'parent-run',
@@ -727,3 +728,27 @@ describe('buildSubagentTickerLines', () => {
expect(lines).toEqual([{ kind: 'error', message: 'recursion limit' }]);
});
});
+
+describe('tail ellipsis direction', () => {
+ it('runs the outer box right to left for Latin text', () => {
+ expect(tailOverflowDirection('Writing the report, done.')).toBe('rtl');
+ expect(textDirection('123 hello')).toBe('ltr');
+ });
+
+ it('runs the outer box left to right for Arabic and Hebrew text', () => {
+ expect(tailOverflowDirection('كتابة التقرير.')).toBe('ltr');
+ expect(tailOverflowDirection('12 שלום עולם')).toBe('ltr');
+ });
+
+ it('follows the first strong character of mixed text', () => {
+ expect(textDirection('(foo) مرحبا')).toBe('ltr');
+ expect(textDirection('... مرحبا foo')).toBe('rtl');
+ });
+
+ it('skips Arabic-Indic digits, Arabic separators and marks like dir="auto" does', () => {
+ expect(textDirection('\u0661\u0662\u0663 report done')).toBe('ltr');
+ expect(textDirection('\u06F1\u06F2\u060C step two')).toBe('ltr');
+ expect(tailOverflowDirection('\u0661\u0662 report done')).toBe('rtl');
+ expect(textDirection('\u0661\u0662 \u0645\u0631\u062D\u0628\u0627')).toBe('rtl');
+ });
+});
diff --git a/client/src/utils/direction.ts b/client/src/utils/direction.ts
new file mode 100644
index 0000000000..cadef9d3d0
--- /dev/null
+++ b/client/src/utils/direction.ts
@@ -0,0 +1,39 @@
+/**
+ * Ranges generated from Bidi_Class in the Unicode 17.0 UnicodeData.txt, matching the Unicode
+ * version of current browsers and runtimes: R and AL, every class other than L, R and AL, and
+ * the few nonspacing marks whose class is L. Unassigned code points, surrogates, controls and
+ * (outside the last table) nonspacing and enclosing marks are left out, so a range spans the
+ * gaps between its members. To regenerate, read field 3 (category) and field 5 (bidi class)
+ * of each code point, expanding the First/Last pairs, apply those exclusions and merge the
+ * code points of each table into ranges.
+ */
+const RTL_STRONG =
+ /[\u05BE-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u07F5\u07FA-\u088F\u08A0-\u08C9\u200F\uFB1D-\uFB28\uFB2A-\uFBC2\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFC\uFE70-\uFEFC\u{10800}-\u{1091B}\u{10920}-\u{10B35}\u{10B40}-\u{10D23}\u{10D4A}-\u{10D65}\u{10D6F}-\u{10D8F}\u{10E80}-\u{10EC7}\u{10F00}-\u{10FF6}\u{1E800}-\u{1EEBB}]/u;
+const NOT_STRONG =
+ /[\u0020-\u0040\u005B-\u0060\u007B-\u00A9\u00AB-\u00B4\u00B6-\u00B9\u00BB-\u00BF\u00D7\u00F7\u02B9-\u02BA\u02C2-\u02CF\u02D2-\u02DF\u02E5-\u02ED\u02EF-\u02FF\u0374-\u0375\u037E\u0384-\u0385\u0387\u03F6\u058A-\u08E2\u09F2-\u09F3\u09FB\u0AF1\u0BF3-\u0BFA\u0C78-\u0C7E\u0E3F\u0F3A-\u0F3D\u1390-\u1399\u1400\u1680\u169B-\u169C\u17DB\u17F0-\u180E\u1940-\u1945\u19DE-\u19FF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD-\u200D\u2010-\u2070\u2074-\u207E\u2080-\u208E\u20A0-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A-\u213B\u2140-\u2144\u214A-\u214D\u2150-\u215F\u2189-\u2335\u237B-\u2394\u2396-\u249B\u24EA-\u26AB\u26AD-\u27FF\u2900-\u2BFF\u2CE5-\u2CEA\u2CF9-\u2CFF\u2E00-\u3004\u3008-\u3020\u3030\u3036-\u3037\u303D-\u303F\u309B-\u309C\u30A0\u30FB\u31C0-\u31EF\u321D-\u321E\u3250-\u325F\u327C-\u327E\u32B1-\u32BF\u32CC-\u32CF\u3377-\u337A\u33DE-\u33DF\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA60D-\uA60F\uA673-\uA67F\uA700-\uA721\uA788\uA828-\uA82B\uA838-\uA839\uA874-\uA877\uAB6A-\uAB6B\uFB29-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFE0-\uFFFD\u{10101}\u{10140}-\u{1018C}\u{10190}-\u{101A0}\u{102E1}-\u{102FB}\u{1091F}-\u{10ED8}\u{11052}-\u{11065}\u{11660}-\u{1166C}\u{11FD5}-\u{11FF1}\u{16FE2}\u{1BCA0}-\u{1CCD5}\u{1CCF0}-\u{1CEF0}\u{1D173}-\u{1D17A}\u{1D1E9}-\u{1D245}\u{1D300}-\u{1D356}\u{1D6C1}\u{1D6DB}\u{1D6FB}\u{1D715}\u{1D735}\u{1D74F}\u{1D76F}\u{1D789}\u{1D7A9}\u{1D7C3}\u{1D7CE}-\u{1D7FF}\u{1E2FF}\u{1EEF0}-\u{1F10F}\u{1F12F}\u{1F16A}-\u{1F16F}\u{1F1AD}\u{1F260}-\u{1FBFA}\u{E0001}-\u{E007F}]/u;
+const LTR_MARK = /[\u0CBF-\u0CC6\u{11A07}-\u{11A08}\u{11C3F}]/u;
+/** Nonspacing and enclosing marks (NSM) and controls (BN, B, S, WS) are never strong. */
+const SKIP = /[\p{Mn}\p{Me}\p{Cc}]/u;
+
+/**
+ * Direction of the first strongly directional character, or null when the text has none,
+ * as the browser's `dir="auto"` resolves it: a character of bidi class R or AL is
+ * right-to-left, L is left-to-right, and digits, punctuation, symbols and marks are skipped.
+ */
+export const strongDirection = (text: string): 'ltr' | 'rtl' | null => {
+ for (const char of text) {
+ if (LTR_MARK.test(char)) {
+ return 'ltr';
+ }
+ if (SKIP.test(char)) {
+ continue;
+ }
+ if (RTL_STRONG.test(char)) {
+ return 'rtl';
+ }
+ if (!NOT_STRONG.test(char)) {
+ return 'ltr';
+ }
+ }
+ return null;
+};
diff --git a/client/src/utils/mermaid.ts b/client/src/utils/mermaid.ts
index c1a08316fb..cdee2f997b 100644
--- a/client/src/utils/mermaid.ts
+++ b/client/src/utils/mermaid.ts
@@ -383,7 +383,7 @@ const btnHover = {
const toolbarStyle = {
position: "absolute",
bottom: "12px",
- right: "12px",
+ insetInlineEnd: "12px",
display: "flex",
alignItems: "center",
gap: "2px",
diff --git a/client/src/utils/subagentContent.ts b/client/src/utils/subagentContent.ts
index 57321d2013..da5e9856b8 100644
--- a/client/src/utils/subagentContent.ts
+++ b/client/src/utils/subagentContent.ts
@@ -1,5 +1,6 @@
import { ContentTypes, ToolCallTypes, getToolTimingDurations } from 'librechat-data-provider';
import type { SubagentUpdateEvent, ToolTimingStamps } from 'librechat-data-provider';
+import { strongDirection } from './direction';
/**
* Client-side helpers for rendering the live `SubagentCall` UI while
@@ -710,11 +711,22 @@ export function initSubagentTickerState(): SubagentTickerState {
}
/** Generous tail window so wide ticker containers aren't half-empty.
- * The component applies CSS tail-ellipsis (`dir="rtl"` +
- * `text-overflow: ellipsis`) so narrow viewports clip from the oldest
- * side; we deliberately DON'T prepend a data-level `…` on top of that
- * CSS ellipsis — double-eliding would render a stray dot character
- * right next to the "Writing:" / "Reasoning:" label. */
+ * The component applies CSS tail-ellipsis: the outer box runs opposite to the
+ * text's own direction (see `tailOverflowDirection`) so narrow viewports clip
+ * from the oldest side; we deliberately DON'T prepend a data-level `…` on top
+ * of that CSS ellipsis, which would render a stray dot next to the
+ * "Writing:" / "Reasoning:" label. */
+/** Direction of the first strongly directional character, as the browser's `dir="auto"` resolves it. */
+export const textDirection = (text: string): 'ltr' | 'rtl' => strongDirection(text) ?? 'ltr';
+
+/**
+ * Direction for the outer box of a tail-ellipsis line. The newest text sits at the
+ * end of the content, so the box runs opposite to the content and the overflow
+ * (and the ellipsis) lands on the oldest side.
+ */
+export const tailOverflowDirection = (text: string): 'ltr' | 'rtl' =>
+ textDirection(text) === 'rtl' ? 'ltr' : 'rtl';
+
const PREVIEW_MAX_CHARS = 300;
const PREVIEW_BUFFER_MAX_CHARS = PREVIEW_MAX_CHARS * 4;
const truncatePreview = (input: string): string => {
diff --git a/client/tailwind.config.cjs b/client/tailwind.config.cjs
index e58bd5a2a4..096c24fe42 100644
--- a/client/tailwind.config.cjs
+++ b/client/tailwind.config.cjs
@@ -43,20 +43,20 @@ module.exports = {
to: { height: 0, opacity: 0 },
},
'slide-in-right': {
- '0%': { transform: 'translateX(100%)' },
+ '0%': { transform: 'translateX(calc(100% * var(--dir-sign, 1)))' },
'100%': { transform: 'translateX(0)' },
},
'slide-in-left': {
- '0%': { transform: 'translateX(-100%)' },
+ '0%': { transform: 'translateX(calc(-100% * var(--dir-sign, 1)))' },
'100%': { transform: 'translateX(0)' },
},
'slide-out-left': {
'0%': { transform: 'translateX(0)' },
- '100%': { transform: 'translateX(-100%)' },
+ '100%': { transform: 'translateX(calc(-100% * var(--dir-sign, 1)))' },
},
'slide-out-right': {
'0%': { transform: 'translateX(0)' },
- '100%': { transform: 'translateX(100%)' },
+ '100%': { transform: 'translateX(calc(100% * var(--dir-sign, 1)))' },
},
'shortcut-shake': {
'0%, 100%': { transform: 'translateX(0)' },
diff --git a/e2e/specs/mock/activity-fold.spec.ts b/e2e/specs/mock/activity-fold.spec.ts
index 116dbd0ea7..8101ffc74d 100644
--- a/e2e/specs/mock/activity-fold.spec.ts
+++ b/e2e/specs/mock/activity-fold.spec.ts
@@ -123,7 +123,7 @@ test.describe('activity fold', () => {
await expect(header).toHaveClass(/font-semibold/);
await expect(header).toHaveClass(/text-text-primary/);
const rail = messagesView(page).getByTestId('activity-phase-panel').locator('> div').first();
- await expect(rail).toHaveClass(/pl-6/);
+ await expect(rail).toHaveClass(/ps-6/);
/** Only the group holding the failure opened; its sibling groups stay
* folded under the phase. The slow echo shares that batch. */
expect(await messagesView(page).locator('[data-testid="tool-call"]').count()).toBe(2);
diff --git a/e2e/specs/mock/scenarios/persisted-context-usage.spec.ts b/e2e/specs/mock/scenarios/persisted-context-usage.spec.ts
index 854a813e8b..4929fe5be3 100644
--- a/e2e/specs/mock/scenarios/persisted-context-usage.spec.ts
+++ b/e2e/specs/mock/scenarios/persisted-context-usage.spec.ts
@@ -324,7 +324,7 @@ test.describe('persisted context usage', () => {
const estimate = popover.getByTestId('context-estimate');
await expect(estimate).toBeVisible({ timeout: 10000 });
- const toolRow = estimate.locator('div.pl-6').getByText('Tool calls', { exact: true });
+ const toolRow = estimate.locator('div.ps-6').getByText('Tool calls', { exact: true });
await expect(toolRow).toBeVisible();
// Tool traffic is already included in the counted assistant total, so the Tool calls subtotal must be nested rather than a peer that would double-count the meter.
diff --git a/e2e/specs/mock/scenarios/rtl-chat.spec.ts b/e2e/specs/mock/scenarios/rtl-chat.spec.ts
new file mode 100644
index 0000000000..d61282acf0
--- /dev/null
+++ b/e2e/specs/mock/scenarios/rtl-chat.spec.ts
@@ -0,0 +1,282 @@
+import { randomUUID } from 'node:crypto';
+import { expect, test } from '@playwright/test';
+import type { Locator, Page } from '@playwright/test';
+import type { SeedMessage } from '../db';
+import { getE2EUser } from '../../../setup/user';
+import {
+ deleteConversations,
+ deleteMessagesByConversation,
+ seedConversations,
+ seedMessages,
+} from '../db';
+import { messagesView } from '../helpers';
+
+const ROOT_PARENT = '00000000-0000-0000-0000-000000000000';
+const ARABIC_PARAGRAPH = 'هذه فقرة عربية تشرح الشيفرة التالية.';
+const ARABIC_HEADING = 'عنوان عربي';
+const ENGLISH_PARAGRAPH = 'This English paragraph sits inside an Arabic reply.';
+const CODE_LINE = 'const greeting = "hello"; // done.';
+
+const REPLY_TEXT = [
+ `## ${ARABIC_HEADING}`,
+ '',
+ `${ARABIC_PARAGRAPH} استخدم \`npm run build\` أولا.`,
+ '',
+ ENGLISH_PARAGRAPH,
+ '',
+ '```js',
+ CODE_LINE,
+ '```',
+ '',
+ '$$',
+ 'x^2 + y^2 = z^2',
+ '$$',
+ '',
+ '> اقتباس عربي قصير',
+ '',
+ '- البند الأول',
+ '',
+ '- البند الثاني',
+ '',
+ '| العمود الأول | Second column |',
+ '| --- | --- |',
+ '| واحد | اثنان |',
+].join('\n');
+
+type Seeded = { conversationId: string };
+
+async function seedReply(texts: string[]): Promise<Seeded> {
+ const conversationId = randomUUID();
+ const userMessageId = randomUUID();
+ const messages: SeedMessage[] = [
+ {
+ messageId: userMessageId,
+ parentMessageId: ROOT_PARENT,
+ text: 'Explain the snippet',
+ isCreatedByUser: true,
+ sender: 'User',
+ },
+ ...texts.map((text) => ({
+ messageId: randomUUID(),
+ parentMessageId: userMessageId,
+ text,
+ isCreatedByUser: false,
+ sender: 'Assistant',
+ model: 'mock-model-a',
+ })),
+ ];
+ const userEmail = getE2EUser().email;
+ await seedConversations(userEmail, [
+ { conversationId, title: 'RTL chat surface', updatedAt: new Date() },
+ ]);
+ await seedMessages(userEmail, conversationId, messages);
+ return { conversationId };
+}
+
+async function cleanup({ conversationId }: Seeded) {
+ await deleteMessagesByConversation([conversationId]);
+ await deleteConversations([conversationId]);
+}
+
+async function openInLanguage(page: Page, lang: string, conversationId: string) {
+ await page.addInitScript((value) => window.localStorage.setItem('lang', value), lang);
+ await page.goto(`/c/${conversationId}`, { timeout: 10000 });
+ await expect(page.locator('html')).toHaveAttribute('dir', lang === 'ar' ? 'rtl' : 'ltr');
+}
+
+const reply = (page: Page) => messagesView(page).locator('.markdown').last();
+
+const box = (locator: Locator) =>
+ locator.evaluate((element) => {
+ const rect = element.getBoundingClientRect();
+ return { left: rect.left, right: rect.right };
+ });
+
+test.describe('RTL chat surface', () => {
+ test('code, inline code and math in an Arabic reply keep left-to-right order @scenario:rtl-reply-code-and-math-stay-ltr', async ({
+ page,
+ }) => {
+ const seeded = await seedReply([REPLY_TEXT]);
+ try {
+ await openInLanguage(page, 'ar', seeded.conversationId);
+ await expect(page.locator('html')).toHaveAttribute('dir', 'rtl');
+
+ const markdown = reply(page);
+ const paragraph = markdown.locator('p', { hasText: ARABIC_PARAGRAPH });
+ await expect(paragraph).toHaveCSS('direction', 'rtl');
+
+ const code = markdown.locator('pre code', { hasText: 'greeting' });
+ await expect(code).toBeVisible();
+ await expect(code).toHaveCSS('direction', 'ltr');
+ await expect(code).toHaveCSS('unicode-bidi', 'isolate');
+
+ const inline = paragraph.locator('code', { hasText: 'npm run build' });
+ await expect(inline).toHaveCSS('direction', 'ltr');
+ await expect(inline).toHaveCSS('unicode-bidi', 'isolate');
+
+ const math = markdown.locator('.katex').first();
+ await expect(math).toBeVisible();
+ await expect(math).toHaveCSS('direction', 'ltr');
+ } finally {
+ await cleanup(seeded);
+ }
+ });
+
+ test('each block of a mixed-language reply takes the direction of its own text @scenario:rtl-reply-blocks-resolve-their-own-direction', async ({
+ page,
+ }) => {
+ const seeded = await seedReply([REPLY_TEXT]);
+ try {
+ await openInLanguage(page, 'ar', seeded.conversationId);
+ const markdown = reply(page);
+
+ const english = markdown.locator('p', { hasText: ENGLISH_PARAGRAPH });
+ await expect(english).toHaveCSS('direction', 'ltr');
+ const heading = markdown.locator('h2', { hasText: ARABIC_HEADING });
+ await expect(heading).toHaveCSS('direction', 'rtl');
+
+ /* The same reply in an English interface still lays the Arabic blocks right to left. */
+ await page.evaluate(() => window.localStorage.setItem('lang', 'en-US'));
+ await page.addInitScript(() => window.localStorage.setItem('lang', 'en-US'));
+ await page.reload();
+ await expect(page.locator('html')).toHaveAttribute('dir', 'ltr');
+ await expect(reply(page).locator('h2', { hasText: ARABIC_HEADING })).toHaveCSS(
+ 'direction',
+ 'rtl',
+ );
+ await expect(reply(page).locator('p', { hasText: ENGLISH_PARAGRAPH })).toHaveCSS(
+ 'direction',
+ 'ltr',
+ );
+ /* A quote and a loose list wrap their text in paragraphs; they still follow it, and the
+ * list indents from the side its markers sit on. */
+ await expect(reply(page).locator('blockquote')).toHaveCSS('direction', 'rtl');
+ const list = reply(page).locator('ul').first();
+ await expect(list).toHaveCSS('direction', 'rtl');
+ /* A table takes one direction from its content, so an English header shares the frame. */
+ await expect(reply(page).locator('th').nth(1)).toHaveCSS('direction', 'rtl');
+ expect(
+ parseFloat(await list.evaluate((el) => getComputedStyle(el).paddingRight)),
+ ).toBeGreaterThan(0);
+ } finally {
+ await cleanup(seeded);
+ }
+ });
+
+ test('quote bar, list indent and table columns start from the right in Arabic @scenario:rtl-quote-list-and-table-mirror', async ({
+ page,
+ }) => {
+ const seeded = await seedReply([REPLY_TEXT]);
+ try {
+ await openInLanguage(page, 'ar', seeded.conversationId);
+ const markdown = reply(page);
+
+ const quote = markdown.locator('blockquote');
+ await quote.scrollIntoViewIfNeeded();
+ await expect(quote).toHaveCSS('border-left-width', '0px');
+ expect(
+ parseFloat(await quote.evaluate((el) => getComputedStyle(el).borderRightWidth)),
+ ).toBeGreaterThan(0);
+
+ const list = markdown.locator('ul').first();
+ await expect(list).toHaveCSS('direction', 'rtl');
+ const listStyle = await list.evaluate((el) => {
+ const style = getComputedStyle(el);
+ return { left: parseFloat(style.paddingLeft), right: parseFloat(style.paddingRight) };
+ });
+ expect(listStyle.right).toBeGreaterThan(0);
+ expect(listStyle.left).toBe(0);
+
+ const headers = markdown.locator('th');
+ await headers.first().scrollIntoViewIfNeeded();
+ const first = await box(headers.nth(0));
+ const second = await box(headers.nth(1));
+ expect(first.left).toBeGreaterThan(second.left);
+ } finally {
+ await cleanup(seeded);
+ }
+ });
+
+ test('an English interface keeps quotes, lists and tables starting from the left @scenario:ltr-reply-layout-unchanged', async ({
+ page,
+ }) => {
+ const seeded = await seedReply([
+ [
+ '> A short quote',
+ '',
+ '- First item',
+ '',
+ '| First | Second |',
+ '| --- | --- |',
+ '| 1 | 2 |',
+ ].join('\n'),
+ ]);
+ try {
+ await openInLanguage(page, 'en-US', seeded.conversationId);
+ await expect(page.locator('html')).toHaveAttribute('dir', 'ltr');
+ const markdown = reply(page);
+
+ const quote = markdown.locator('blockquote');
+ await expect(quote).toHaveCSS('border-right-width', '0px');
+ expect(
+ parseFloat(await quote.evaluate((el) => getComputedStyle(el).borderLeftWidth)),
+ ).toBeGreaterThan(0);
+
+ const list = markdown.locator('ul').first();
+ const paddingLeft = await list.evaluate((el) => parseFloat(getComputedStyle(el).paddingLeft));
+ expect(paddingLeft).toBeGreaterThan(0);
+
+ const headers = markdown.locator('th');
+ const first = await box(headers.nth(0));
+ const second = await box(headers.nth(1));
+ expect(first.left).toBeLessThan(second.left);
+ } finally {
+ await cleanup(seeded);
+ }
+ });
+
+ test('the previous and next reply arrows point outward from the counter in Arabic @scenario:rtl-sibling-switch-mirrors', async ({
+ page,
+ }) => {
+ const seeded = await seedReply(['الرد الأول', 'الرد الثاني']);
+ try {
+ await openInLanguage(page, 'ar', seeded.conversationId);
+ const view = messagesView(page);
+ await expect(view.getByText('الرد الثاني')).toBeVisible();
+
+ const previous = view.getByRole('button', { name: 'Previous sibling message' });
+ const next = view.getByRole('button', { name: 'Next sibling message' });
+ await expect(previous).toBeVisible();
+ const previousBox = await box(previous);
+ const nextBox = await box(next);
+ expect(previousBox.left).toBeGreaterThan(nextBox.left);
+
+ /* The chevrons are mirrored, so "previous" points right, away from the counter. */
+ const scaleX = await previous
+ .locator('svg')
+ .evaluate((el) => parseFloat(getComputedStyle(el).scale));
+ expect(scaleX).toBe(-1);
+
+ await expect(view.getByRole('status').filter({ hasText: '2 / 2' })).toBeVisible();
+ await previous.click();
+ await expect(view.getByText('الرد الأول')).toBeVisible();
+ await expect(view.getByRole('status').filter({ hasText: '1 / 2' })).toBeVisible();
+ } finally {
+ await cleanup(seeded);
+ }
+ });
+
+ test('the virtualized chat list follows the interface direction @scenario:rtl-virtualized-list-follows-direction', async ({
+ page,
+ }) => {
+ const seeded = await seedReply(['مرحبا']);
+ try {
+ await openInLanguage(page, 'ar', seeded.conversationId);
+ const grid = page.locator('.ReactVirtualized__Grid').first();
+ await expect(grid).toBeAttached();
+ await expect(grid).toHaveCSS('direction', 'rtl');
+ } finally {
+ await cleanup(seeded);
+ }
+ });
+});
diff --git a/e2e/specs/mock/scenarios/tool-context-split.spec.ts b/e2e/specs/mock/scenarios/tool-context-split.spec.ts
index 67d887ddca..f4118cfc59 100644
--- a/e2e/specs/mock/scenarios/tool-context-split.spec.ts
+++ b/e2e/specs/mock/scenarios/tool-context-split.spec.ts
@@ -75,7 +75,7 @@ async function runToolTurn(page: Page, prefix: string) {
}
function directPeerRows(breakdown: Locator) {
- return breakdown.locator(':scope > *:not(.pl-6)');
+ return breakdown.locator(':scope > *:not(.ps-6)');
}
function rowValue(row: Locator) {
@@ -109,8 +109,8 @@ test.describe('retained tool context split', () => {
await expect(toolRow).toHaveCount(1);
await expect(messageRow).toHaveCount(1);
// Tool calls and Messages are meter peers, not an indented subset row.
- await expect(toolRow.locator('xpath=ancestor::*[contains(@class, "pl-6")]')).toHaveCount(0);
- await expect(messageRow.locator('xpath=ancestor::*[contains(@class, "pl-6")]')).toHaveCount(0);
+ await expect(toolRow.locator('xpath=ancestor::*[contains(@class, "ps-6")]')).toHaveCount(0);
+ await expect(messageRow.locator('xpath=ancestor::*[contains(@class, "ps-6")]')).toHaveCount(0);
const toolValue = (await rowValue(toolRow).innerText()).split('(')[0].trim();
const messageValue = (await rowValue(messageRow).innerText()).split('(')[0].trim();
diff --git a/eslint-suppressions.json b/eslint-suppressions.json
index d66b56d996..6d46e02e8c 100644
--- a/eslint-suppressions.json
+++ b/eslint-suppressions.json
@@ -257,7 +257,7 @@
},
"client/src/components/Chat/Messages/Content/DialogImage.tsx": {
"shadcn/no-arbitrary-values": {
- "count": 2
+ "count": 1
},
"shadcn/no-inline-styles": {
"count": 1
@@ -569,7 +569,7 @@
},
"client/src/components/Chat/Trace/Ledger.tsx": {
"shadcn/no-inline-styles": {
- "count": 4
+ "count": 2
}
},
"client/src/components/Chat/Trace/Viewer.tsx": {