Skip to content

fix(web): keep restore row names in their own direction in right-to-left languages - #5007

Merged
Quick104 merged 1 commit into
mainfrom
fix/restore-row-name-direction
Nov 21, 2026
Merged

Quick104 merged 1 commit into
mainfrom
fix/restore-row-name-direction

Conversation

@Quick104

@Quick104 Quick104 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #4837
Closes #4720
Related issue: N/A
Validation tasks: none

Other clients: N/A (backup restore is only in the web admin)

In Arabic, the backup restore screen cut a left-to-right name at its start instead of its end. A long collection name showed as "…and Thoroughly Documented Expedition of Everyone Who Ever Came Back Again logo" and a long username as "…na.vandenberghe.of.the.northern.archive". A name that starts with a year read out of order, so "2001: A Space Odyssey fan club" showed as "A Space Odyssey fan club :2001". With this change, each name on the Choose step reads in its own direction, so a cut name keeps its start and ends in "…".

Each name took the page's direction. On a right-to-left page, text-overflow: ellipsis and overflow-x: clip cut the left side, which is where a left-to-right name begins, and the bidi algorithm placed a leading number on the right.

Approach

Each name on the Choose step now reads in the direction of its own text, following the rule in web/src/i18n/README.md for names cut with truncate. That covers the item and account rows, the folded "match this server" list, and an account's profiles. A new nameDir in restoreModel.ts returns dir="auto", with two exceptions. An account named by its email (an invited account, or one with no username) uses emailDir, so it reads the same way as the email lines in the other admin lists. A branding name is translated interface text, so it follows the page.

In the item and account rows, the name moves into a span inside the label. The span carries the direction and the cut, is sized to its text, and is the box useOverflowsInline measures and clips (#4849), since a name now overflows toward its own end. The label still spans the column, so a click anywhere on it still toggles the row, and it still takes the name's share of a one-line row (#4978). The span replaces the <bdi> that #4928 added for addresses that start with digits, and keeps those in order too.

Each name takes align-with-page, so a wrapped one lines up with the page's start side beside its checkbox. Without it, Chromium aligned a name that runs against the page to the name's own start, while Firefox and Safari kept the page's. A cut name still keeps its start, because browsers lay out an overflowing line from its own start. The i18n README and the align-with-page comment now cover names as well as paths.

The detail lines are unchanged: they are translated sentences and follow the page.

Validation

  • Reproduced on a Silo dev deployment. A backup held collections and an account with long English, Arabic, digit-first and mixed-direction names, which were then deleted so Restore listed them as new. With the interface in Arabic, the Choose step at 1440 and 820 px cut the English names at their start and showed the year-first name out of order, in Chromium, Firefox and WebKit. After the change, every name keeps its start and reads in order, and Arabic names look the same as before.
  • Later backups covered the matching list, profile names, names made of a run of joined emoji that can't wrap, and accounts named by their address. "2001: …" names read out of order there before the change and in order after. Unbreakable names still clip inside their column, at the name's end. An address starting with digits reads in order. A long address beside its "to add" summary lost its start before; it now keeps it and ends in "…", Safari's engine included.
  • A script measured each name at 1440, 820 and 390 px: whether its first character is inside its box, and its gap to the checkbox. After the change, no name lost its first character in any engine, and at 390 px every name sat 12 px from its checkbox in every engine. Clicking the blank part of a short name's line still ticks its checkbox, and the page doesn't scroll sideways at 390 px.
  • English names look the same before and after. With this data, fix(web): let a restore row name use the room a short detail leaves #4978's width sharing gives Arabic names room to fit on an English page, so the mirror case (an Arabic name losing its start there) doesn't show.
  • The same checks passed on the deployment's own build of this branch, with no console errors.
  • No 1.0 validation case covers backup restore.
  • Web gate (lint, format check, build, bundle budget, local paths), tsc and the restore page's tests: pass. No new test: jsdom does no layout and can't show which side of a name is cut.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/issue-4837/

Risks

A name that mixes directions reads in the direction of its first letter. In Arabic, "Midnight Classics أفلام منتصف الليل …" now reads left to right. When it is cut short, it keeps "Midnight Classics" and the end of the Arabic part, and hides the Arabic part's start, which showed before. No single direction keeps every part of a mixed name; the i18n README documents this limit, and the full name stays in the tooltip.

A name with no letters, such as a run of emoji, reads left to right, as the README says. When one is too long to wrap, it is now clipped at its right end, beside the checkbox, instead of at the far end.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or how I checked a change nobody sees.

Council review

Plan round: skipped. The fix applies the i18n README's existing rule for names.

Code review (xhigh), 3 rounds. Fixed:

  • Accounts named by their email read as emails, and branding names follow the page.
  • The label's click area is kept.
  • The overflow measurement and clip moved onto the name span. A name that can't wrap had run over the checkbox in narrow rows.
  • Physical alignment classes were replaced with align-with-page.
  • Docs now cover names.

Answered: mixed-direction names, which are a documented limit; letter-free names reading left to right, also documented; the profile label's 4 px overhang, measured, and nothing scrolls.

Background review: running on c13e49b

Member Round 1
Sol (gpt-6.2-sol, xhigh) running
Opus (claude-opus-5-5, high) running
Gemini (gemini-4-neon, xhigh) running

Visual review: 2 rounds. Round 2 reviewed 2810ccd8's captures; the head differs only in the unbreakable-name fix and main's width sharing, both rechecked live.

Member Round 1 Round 2
Sol better, 8/10 better, 8.5/10
Opus better, 7/10 better, 8/10
Gemini unavailable (quota) better, 8/10

Fixed: wrapped names now line up with the page's start side in every browser. Answered: an overflowing name that can't wrap is clipped without "…", as it was before (#4755), but now at its own end.

AI Disclosure

  • Harness: Claude Code in T3 Code
  • Tool(s): Claude Code; Playwright (headless Chromium, Firefox and WebKit) for captures and measurements
  • Model(s): claude-opus-5-5 (implementation and code review); gpt-6.2-sol, claude-opus-5-5 and gemini-4-neon (visual and adversarial review)
  • Involvement: Fully AI-generated. The agent verified it on a Silo dev deployment; a person has not verified it yet.
  • Adversarial review: see Council review above; the background review posts its findings on this pull request.

🤖 Generated with Claude Code

Note

Fix restore row name direction for right-to-left languages

Adds a nameDir helper in restoreModel.ts that picks a direction per restore item: no explicit direction for branding items, auto for most labels, and emailDir for email-like account labels.

  • Applies nameDir to name spans in RestoreRows.tsx and RestoreUsers.tsx, moving overflow measurement, truncation, and clipping onto the name span. Wrapped lines align with the page via align-with-page.
  • Replaces the <bdi> wrapper in the restore account row with the directional span, and sets profile names to auto.
  • Updates directionality guidance in README.md and the align-with-page docs in app.css.

Macroscope summarized c13e49b.

…eft languages

In Arabic, a restore row name that was cut short took the page's direction,
so a left-to-right name lost its start ("…xpedition of Everyone … logo"),
and a name that starts with digits read out of order ("… Its Share :2001").

The item, account, matching-item and profile names on the Choose step now
read in the direction of their own text, so a cut or clipped name keeps its
start and ends in "…" in either script. An account named by its email reads
as emails do in the other admin lists (emailDir); a branding name, which is
interface text, follows the page.

In the item and account rows the name is a span inside the label: the span
carries the direction, the cut, and the overflow measurement and clip, since
it overflows toward its own end; the label still spans a narrow row's column,
so a click anywhere on it toggles the row, and takes the name's share of a
one-line row. Each name takes align-with-page, so a wrapped one stays beside
its checkbox in every browser. The i18n README and the align-with-page
comment now cover names.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Nov 21, 2026
@silo-kody

silo-kody Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9164e8b4-0679-4928-bbfe-6d84be5a7d84
Commits

Reviewing files that changed from the base of the PR and between b633977 and c13e49b.

Files selected for processing: 5

  • web/src/app.css
  • web/src/i18n/README.md
  • web/src/pages/admin-backups/RestoreRows.tsx
  • web/src/pages/admin-backups/RestoreUsers.tsx
  • web/src/pages/admin-backups/restoreModel.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T10:04:24.911895Z c13e49b PR opened
🔒 Security Review ✅ Completed 2026-11-21T10:06:31.551100Z c13e49b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@silo-triage silo-triage Bot added bug Something isn't working impact: polish Annoyance, cosmetic, or nice-to-have priority: P2 Limited scope, workaround exists, or polish labels Nov 21, 2026

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial review (Claude Opus 5.5, reviewed c13e49b)

One nit from the simplification pass, inline below. I found no correctness problem in nameDir or its callers. Rows sends an account that has no account to ItemRow, so the @ fallback is needed. SameRow and ProfileRow look right too.

>
<BreakableKey value={label} />
<span
ref={nameRef}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the inner span may not be needed.

Trigger: every ItemRow and AccountRow name.

The Label already spans a narrow row's column and is capped at its text in a one-line row, so it can be the name's own box. I built a static right-to-left test page and rendered it in Chromium, Firefox and WebKit through Playwright. It compared this span with a Label that carries dir="auto" and align-with-page directly and keeps main's classes (@2xl:truncate, [&_wbr]:hidden, the overflow clip, the useOverflowsInline ref). The two forms gave the same name box and the same text start and end in every engine. I checked 300 px rows (name above a path) and 800 px rows (path beside the name) with a short Latin name, a Latin name that wraps, "2001: A Space Odyssey…", an Arabic name, and one unbreakable emoji sequence with the clip on. A short name stays beside the checkbox because align-with-page puts it there. A cut name keeps its start and its "…", and the clip lands at the name's end.

Impact: the span adds an element to two rows, moves their classes, changes the ref type, and needs the longer comments in both rows. It also needs the README's new sentence about putting the clip and the measurement on the name's own box. A dir attribute isolates the name as <bdi> did, so AccountRow can drop its inner element the same way.

Limit: the page used hand-written CSS equivalents of the Tailwind classes and a class in place of the container query, not the built app. If the dev deployment showed a case where the Label-only form breaks, keep the span.

Suggested repair: drop the span. Put dir={nameDir(item)} and align-with-page on the Label in ItemRow and AccountRow (replacing <bdi> there), keep main's Label classes and ref, and shorten the comments to match.

@Quick104
Quick104 merged commit 3a8bd22 into main Nov 21, 2026
21 checks passed
@Quick104
Quick104 deleted the fix/restore-row-name-direction branch November 21, 2026 10:14

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial review (Gemini 4 Neon, reviewed c13e49b).

Checked every caller of ItemRow, SameRow, AccountRow, ProfileRow, and nameDir, the @2xl flex/truncation split, useOverflowsInline, and the align-with-page rules. Two minor issues sit on diff lines (inline below), and one pre-existing omission in AccountRow sits outside the diff hunk:

G1 (Low): AccountRow still hardcodes dir="ltr" on its truncated contact email line

  • Trigger: On a right-to-left (Arabic) page, an account on the restore Choose step with a username, a long Arabic-script email (accepted by internal/auth/email.go), and no pending-data summary (new, blocked, or matched with nothing pending) when contact truncates (web/src/pages/admin-backups/RestoreUsers.tsx:280).
  • Impact: dir="ltr" places the ellipsis on the right (the start of the Arabic address), cutting its start off. Nineteen lines above in the same component (RestoreUsers.tsx:261), an account labeled by its email uses nameDir (emailDir) and keeps its start. Line 280 is now the only truncated email in web/src/ that does not follow web/src/i18n/README.md's emailDir rule (contrast AdminUserCompactList.tsx:72, AccessGroupMembers.tsx:347, UsersWidget.tsx:119, and InvitationList.tsx:199).
  • Evidence: web/src/pages/admin-backups/RestoreUsers.tsx:210-216,261,272-284, web/src/pages/admin-backups/restoreModel.ts:215-228, web/src/lib/direction.test.ts:9-10, and web/src/i18n/README.md:167-170.
  • Suggested repair: Import emailDir from @/lib/direction, change line 280 to dir={pending ? undefined : emailDir(contact)}, and update the comment on lines 272-274.

* name is interface text, so it follows the page.
*/
export function nameDir(item: Pick<RestoreItem, "kind" | "label" | "account">) {
if (item.kind === "branding") return undefined;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

G2 (Low): Unknown or unusable branding entries are not translated interface text

  • Trigger: A branding item whose label is not in BRANDING_NAMES (an unknown key from a newer server, an unreadable branding entry from internal/backup/restoreset_decode.go:328, or the "<N> more entries" overflow summary from restoreset_decode.go:153) rendered on a right-to-left page.
  • Impact: displayLabel (restoreModel.ts:199-211) translates only keys present in BRANDING_NAMES and falls back to the raw label text for anything else. Returning undefined unconditionally for item.kind === "branding" leaves those fallback English or digit-first labels (such as "5 more entries") in the page's RTL direction so they read out of order, and clips an unbreakable unknown key at its start instead of its end.
  • Evidence: web/src/pages/admin-backups/restoreModel.ts:185-228 and internal/backup/restoreset_decode.go:142-156,328,335.
  • Suggested repair: Gate the undefined branch on BRANDING_NAMES so only translated branding labels follow the page:
    if (item.kind === "branding") {
      return Object.hasOwn(BRANDING_NAMES, item.label) ? undefined : "auto";
    }

Comment thread web/src/i18n/README.md
Comment on lines +153 to +155
a `block` span inside it. A name that can also wrap takes `align-with-page`, so its
wrapped lines stay on the page's start side in every browser; Chromium otherwise puts
them on the name's own start side. A clip, or a measurement of whether the name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

G3 (Low): align-with-page is needed across browsers outside <li>, not only in Chromium

  • Trigger: Applying this rule to a wrapping dir="auto" name outside a list item (for example in a <div>, card, or table cell).
  • Impact: Saying "Chromium otherwise puts them on the name's own start side" narrows a cross-browser CSS rule to Chromium and disagrees with lines 133-136 above. Inherited text-align: start resolves against the element's own dir in Chromium, Firefox, and Safari alike; Firefox and Safari only mask it inside <li> because their user-agent stylesheets give li text-align: match-parent.
  • Evidence: web/src/i18n/README.md:133-136 vs 153-155.
  • Suggested repair: State that without align-with-page, inherited start puts wrapped lines on the name's own start side (and that Firefox and Safari only hide this inside <li>, as the path rule above notes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working impact: polish Annoyance, cosmetic, or nice-to-have priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority.

Projects

None yet

1 participant