Repository navigation
fix(web): keep restore row names in their own direction in right-to-left languages - #5007
Conversation
…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 Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
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. View limit details
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Quick104
left a comment
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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) whencontacttruncates (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 usesnameDir(emailDir) and keeps its start. Line 280 is now the only truncated email inweb/src/that does not followweb/src/i18n/README.md'semailDirrule (contrastAdminUserCompactList.tsx:72,AccessGroupMembers.tsx:347,UsersWidget.tsx:119, andInvitationList.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, andweb/src/i18n/README.md:167-170. - Suggested repair: Import
emailDirfrom@/lib/direction, change line 280 todir={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; |
There was a problem hiding this comment.
G2 (Low): Unknown or unusable branding entries are not translated interface text
- Trigger: A
brandingitem whoselabelis not inBRANDING_NAMES(an unknown key from a newer server, an unreadable branding entry frominternal/backup/restoreset_decode.go:328, or the"<N> more entries"overflow summary fromrestoreset_decode.go:153) rendered on a right-to-left page. - Impact:
displayLabel(restoreModel.ts:199-211) translates only keys present inBRANDING_NAMESand falls back to the raw label text for anything else. Returningundefinedunconditionally foritem.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-228andinternal/backup/restoreset_decode.go:142-156,328,335. - Suggested repair: Gate the
undefinedbranch onBRANDING_NAMESso only translated branding labels follow the page:if (item.kind === "branding") { return Object.hasOwn(BRANDING_NAMES, item.label) ? undefined : "auto"; }
| 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 |
There was a problem hiding this comment.
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: startresolves against the element's owndirin Chromium, Firefox, and Safari alike; Firefox and Safari only mask it inside<li>because their user-agent stylesheets givelitext-align: match-parent. - Evidence:
web/src/i18n/README.md:133-136vs153-155. - Suggested repair: State that without
align-with-page, inheritedstartputs 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).
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: ellipsisandoverflow-x: clipcut 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.mdfor names cut withtruncate. That covers the item and account rows, the folded "match this server" list, and an account's profiles. A newnameDirinrestoreModel.tsreturnsdir="auto", with two exceptions. An account named by its email (an invited account, or one with no username) usesemailDir, 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
useOverflowsInlinemeasures 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 thealign-with-pagecomment now cover names as well as paths.The detail lines are unchanged: they are translated sentences and follow the page.
Validation
tscand 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
Council review
Plan round: skipped. The fix applies the i18n README's existing rule for names.
Code review (xhigh), 3 rounds. Fixed:
align-with-page.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
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.
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
🤖 Generated with Claude Code
Note
Fix restore row name direction for right-to-left languages
Adds a
nameDirhelper in restoreModel.ts that picks a direction per restore item: no explicit direction for branding items,autofor most labels, andemailDirfor email-like account labels.nameDirto name spans in RestoreRows.tsx and RestoreUsers.tsx, moving overflow measurement, truncation, and clipping onto the name span. Wrapped lines align with the page viaalign-with-page.<bdi>wrapper in the restore account row with the directional span, and sets profile names toauto.align-with-pagedocs in app.css.Macroscope summarized c13e49b.