diff --git a/nix/package.nix b/nix/package.nix index b8149a247e..f98e4918e3 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -70,7 +70,7 @@ buildNpmPackage { ); }; - npmDepsHash = "sha256-opPDVJzm5OX6Pq1YHISvQnuCv6X448cMWtdRPLGnER0="; + npmDepsHash = "sha256-mU/NFxCREiONfaFKeCLgfMV8rMebd/nDc8u22/JS0BM="; env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; diff --git a/package-lock.json b/package-lock.json index f7e98e1baf..16ad7fc785 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "@modelcontextprotocol/sdk": "^1.31.0", "@radix-ui/react-accordion": "^1.2.12", "@radix-ui/react-dialog": "^1.1.15", + "@radix-ui/react-direction": "1.1.1", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-popover": "^1.1.15", "@radix-ui/react-select": "^2.2.6", diff --git a/package.json b/package.json index 25063164ec..28f01d1566 100644 --- a/package.json +++ b/package.json @@ -109,6 +109,7 @@ "@modelcontextprotocol/sdk": "^1.31.0", "@radix-ui/react-accordion": "^1.2.12", "@radix-ui/react-dialog": "^1.1.15", + "@radix-ui/react-direction": "1.1.1", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-popover": "^1.1.15", "@radix-ui/react-select": "^2.2.6", diff --git a/src/components/ai-edition/AudioTrackPane.test.tsx b/src/components/ai-edition/AudioTrackPane.test.tsx index 0108882170..2f590c53c5 100644 --- a/src/components/ai-edition/AudioTrackPane.test.tsx +++ b/src/components/ai-edition/AudioTrackPane.test.tsx @@ -48,7 +48,7 @@ describe("AudioTrackPane", () => { const closeBtn = screen.getByRole("button", { name: "common.actions.close" }); expect(closeBtn).toBeInTheDocument(); const header = closeBtn.closest("header"); - expect(header).toHaveStyle({ paddingRight: "var(--sp-4)" }); + expect(header).toHaveStyle({ paddingInlineEnd: "var(--sp-4)" }); const svg = closeBtn.querySelector("svg"); expect(svg?.classList.contains("lucide-x")).toBe(true); diff --git a/src/components/ai-edition/CaptionsPane.tsx b/src/components/ai-edition/CaptionsPane.tsx index d34aed06b1..36a4f60296 100644 --- a/src/components/ai-edition/CaptionsPane.tsx +++ b/src/components/ai-edition/CaptionsPane.tsx @@ -601,6 +601,7 @@ export function CaptionsPane({ onClose }: { onClose?: () => void } = {}) { label={t("captions.position")} columns={3} + dir="ltr" options={CAPTION_ANCHORS.map(([v, h]) => ({ value: `${v}-${h}`, label: t(CAPTION_ANCHOR_KEYS[`${v}-${h}`]), diff --git a/src/components/ai-edition/ChatMarkdown.module.css b/src/components/ai-edition/ChatMarkdown.module.css index a9de16b7cb..a44f4aff7c 100644 --- a/src/components/ai-edition/ChatMarkdown.module.css +++ b/src/components/ai-edition/ChatMarkdown.module.css @@ -2,16 +2,16 @@ .markdown > :first-child { margin-top: 0; } .markdown > :last-child { margin-bottom: 0; } .markdown p { white-space: pre-wrap; } -.markdown pre { overflow-x: auto; padding: 10px; border-radius: 6px; background: var(--surface-3); color: var(--fg); white-space: pre; } +.markdown pre { direction: ltr; overflow-x: auto; padding: 10px; border-radius: 6px; background: var(--surface-3); color: var(--fg); white-space: pre; } .markdown code { font-family: monospace; } .markdown h1, .markdown h2, .markdown h3 { font-size: 1.1em; margin: 12px 0 6px; } -.markdown ul, .markdown ol { padding-left: 22px; } +.markdown ul, .markdown ol { padding-inline-start: 22px; } /* Tailwind's preflight strips every list marker; a chat list read as indented loose lines. */ .markdown ul { list-style: disc; } .markdown ol { list-style: decimal; } .markdown ul ul { list-style: circle; } .markdown :global(.contains-task-list) { list-style: none; } -.markdown blockquote { margin-left: 0; padding-left: 12px; border-left: 2px solid var(--muted); } +.markdown blockquote { margin-inline-start: 0; padding-inline-start: 12px; border-inline-start: 2px solid var(--muted); } .markdown table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; } .markdown th, .markdown td { padding: 5px 8px; border: 1px solid var(--border, #444); } .markdown a { color: var(--accent, #7cb8ff); text-decoration: underline; } diff --git a/src/components/ai-edition/ChatMarkdown.tsx b/src/components/ai-edition/ChatMarkdown.tsx index 46e02f41a0..8f266d832d 100644 --- a/src/components/ai-edition/ChatMarkdown.tsx +++ b/src/components/ai-edition/ChatMarkdown.tsx @@ -5,7 +5,7 @@ import styles from "./ChatMarkdown.module.css"; /** Render Markdown as React elements; HTML is skipped and unsafe URL schemes are rejected. */ export function ChatMarkdown({ text }: { text: string }) { return ( -
+
{t("chat.welcome.cta")} - +

diff --git a/src/components/ai-edition/ChoiceRow.test.tsx b/src/components/ai-edition/ChoiceRow.test.tsx index 6fdd86145f..7ab20f9739 100644 --- a/src/components/ai-edition/ChoiceRow.test.tsx +++ b/src/components/ai-edition/ChoiceRow.test.tsx @@ -3,6 +3,7 @@ // option past them stays reachable from the keyboard. import "@testing-library/jest-dom"; +import { DirectionProvider } from "@radix-ui/react-direction"; import { act, fireEvent, render, screen } from "@testing-library/react"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; @@ -42,6 +43,30 @@ describe("ChoiceRow keyboard", () => { expect(onChange).not.toHaveBeenCalled(); expect(screen.getByRole("button", { name: "one" })).toHaveFocus(); }); + + it.each([ + { dir: undefined, nextKey: "ArrowLeft" }, + { dir: "ltr" as const, nextKey: "ArrowRight" }, + ])("navigates a row in an RTL page with dir=$dir", ({ dir, nextKey }) => { + const onChange = vi.fn(); + render( + + + , + ); + fireEvent.keyDown(screen.getByRole("group", { name: "row" }), { key: nextKey }); + expect(onChange).toHaveBeenLastCalledWith(2); + expect(screen.getByRole("button", { name: "two" })).toHaveFocus(); + }); }); // A tooltip that says what the button already says is noise (tooltips.md, rule 3). A button with diff --git a/src/components/ai-edition/LeftPanel.tsx b/src/components/ai-edition/LeftPanel.tsx index 18e4bbb3db..9072892121 100644 --- a/src/components/ai-edition/LeftPanel.tsx +++ b/src/components/ai-edition/LeftPanel.tsx @@ -1,3 +1,4 @@ +import { useDirection } from "@radix-ui/react-direction"; import { ArrowLeft, Check, Loader2, Square, X } from "lucide-react"; import { useCallback, useEffect, useRef, useState } from "react"; import { createPortal } from "react-dom"; @@ -76,7 +77,7 @@ function ModelQuickPopover({ onConfigChange, onOpenFullSettings, }: { - anchorRect: { left: number; bottom: number; maxHeight: number }; + anchorRect: { inlineStart: number; bottom: number; maxHeight: number }; llmConfig: AiEditionLlmConfig; connectedProviders: string[]; onClose: () => void; @@ -155,7 +156,7 @@ function ModelQuickPopover({

- + {screen === "models" ? t("chat.changeProvider") : t("chat.back")}