fix(client): spacing and alignment follow the reading direction

Arabic runs the app right to left, but margins, paddings, insets, text
alignment, borders and corner radii were written for the left side, so
icons sat against the wrong edge of their labels, indents and badges
pointed the wrong way and amount columns aligned left. They now use the
logical forms (ms-, ps-, start-, text-start, marginInlineStart,
insetInlineEnd and their CSS equivalents), which are the very same sides
in a left to right language. Geometry stays physical on purpose: maps,
positions measured from the pointer or a bounding box, time axes,
sliders, transforms and print output.

Amounts drawn as several spans keep their order in a right to left row,
the time picker keeps hours before minutes, and two switches whose thumb
slid out of its track in Arabic now move the right way.

lint:rtl counts what is still physical per file against a baseline that
may only shrink (1512 uses in 370 files before, 319 in 113 now), and CI
runs it, so new code reaches for the logical forms.
This commit is contained in:
Maurice
2026-10-07 22:33:58 +00:00
parent de128cc4ae
commit ba70ad28b8
315 changed files with 1300 additions and 1004 deletions
+2 -2
View File
@@ -46,8 +46,8 @@ export default function HelpBadge({
}): React.ReactElement {
return (
<span
className={`inline-flex items-center gap-1.5 h-7 rounded-full pl-2.5 text-caption font-semibold leading-none whitespace-nowrap ${
count === undefined ? 'pr-2.5' : 'pr-1'
className={`inline-flex items-center gap-1.5 h-7 rounded-full ps-2.5 text-caption font-semibold leading-none whitespace-nowrap ${
count === undefined ? 'pe-2.5' : 'pe-1'
} ${uppercase ? 'uppercase tracking-[0.08em]' : ''} ${TONES[tone]} ${className}`}
>
{Icon && <Icon className="w-3.5 h-3.5 flex-shrink-0" />}
+6 -6
View File
@@ -60,7 +60,7 @@ export default function HelpGuideView({ guide }: { guide: HelpGuide }): React.Re
{guide.media.steps && <HelpBadge tone="neutral" icon={Camera} count={guide.steps}>{t('help.center.screenshot')}</HelpBadge>}
{/* One way out of the header: into the screen. The docs link waits at the bottom. */}
{screen && screenRoute && (
<Link to={screenRoute} onClick={closeHelp} className="ml-auto">
<Link to={screenRoute} onClick={closeHelp} className="ms-auto">
<HelpBadge tone="accent" icon={ArrowUpRight} className="hover:bg-accent-hover transition-colors">
{t('help.center.goToScreen', { screen: t(ctxKey(screen.id, 'title')) })}
</HelpBadge>
@@ -76,7 +76,7 @@ export default function HelpGuideView({ guide }: { guide: HelpGuide }): React.Re
</div>
<ol className="relative flex flex-col gap-3">
{/* The rail: runs behind the step numbers from the first to the last. */}
<span className="absolute left-[27px] top-6 bottom-6 w-px bg-edge" aria-hidden="true" />
<span className="absolute start-[27px] top-6 bottom-6 w-px bg-edge" aria-hidden="true" />
{steps.map(n => {
const text = t(guideStepKey(guide.id, n))
const src = helpMedia.step(guide.id, n)
@@ -117,7 +117,7 @@ export default function HelpGuideView({ guide }: { guide: HelpGuide }): React.Re
box, and covering it would crop away the sides the
ring is drawn on. */}
<img src={src} alt="" loading="lazy" decoding="async" className="block w-full aspect-[16/10] object-contain" />
<span className="absolute bottom-2 right-2 w-8 h-8 rounded-full bg-inverse text-inverse-text flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity shadow-elevated">
<span className="absolute bottom-2 end-2 w-8 h-8 rounded-full bg-inverse text-inverse-text flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity shadow-elevated">
<Maximize2 className="w-3.5 h-3.5" />
</span>
</button>
@@ -146,10 +146,10 @@ export default function HelpGuideView({ guide }: { guide: HelpGuide }): React.Re
className="trek-help-shot group relative rounded-xl overflow-hidden border border-edge-secondary bg-surface-tertiary"
>
<img src={helpMedia.result(guide.id)} alt="" loading="lazy" decoding="async" className="block w-full aspect-video object-contain" />
<span className="absolute bottom-2 left-2">
<span className="absolute bottom-2 start-2">
<HelpBadge tone="success" icon={CheckCircle2}>{t('help.center.result')}</HelpBadge>
</span>
<span className="absolute bottom-2 right-2 w-8 h-8 rounded-full bg-inverse text-inverse-text flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity shadow-elevated">
<span className="absolute bottom-2 end-2 w-8 h-8 rounded-full bg-inverse text-inverse-text flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity shadow-elevated">
<Maximize2 className="w-3.5 h-3.5" />
</span>
</button>
@@ -205,7 +205,7 @@ export default function HelpGuideView({ guide }: { guide: HelpGuide }): React.Re
<button
type="button"
onClick={() => openGuide(g.id)}
className="group w-full flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left hover:bg-surface-hover transition-colors"
className="group w-full flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-start hover:bg-surface-hover transition-colors"
>
<span className="w-7 h-7 rounded-md bg-surface-tertiary text-content-muted flex items-center justify-center flex-shrink-0 group-hover:bg-accent group-hover:text-accent-text transition-colors">
<RelIcon className="w-3.5 h-3.5" />
+5 -5
View File
@@ -67,7 +67,7 @@ export default function HelpHome({ context }: { context: HelpContext | null }):
<HelpBadge tone="accent" icon={ListOrdered} count={guides.length}>{t('help.center.searchGuides')}</HelpBadge>
{context.docs.length > 0 && <HelpBadge tone="neutral" icon={BookOpen} count={context.docs.length}>{t('help.center.searchDocs')}</HelpBadge>}
{screenRoute && (
<Link to={screenRoute} onClick={closeHelp} className="ml-auto">
<Link to={screenRoute} onClick={closeHelp} className="ms-auto">
<HelpBadge tone="accent" icon={ArrowUpRight} className="hover:bg-accent-hover transition-colors">
{t('help.center.goToScreen', { screen: t(ctxKey(context.id, 'title')) })}
</HelpBadge>
@@ -83,7 +83,7 @@ export default function HelpHome({ context }: { context: HelpContext | null }):
type="button"
onClick={() => setSubScreensOpen(o => !o)}
aria-expanded={subScreensOpen}
className="flex items-center gap-3 p-4 text-left rounded-2xl hover:bg-surface-hover transition-colors"
className="flex items-center gap-3 p-4 text-start rounded-2xl hover:bg-surface-hover transition-colors"
>
<HelpBadge tone="neutral" icon={LayoutGrid} uppercase count={children.length}>{t('help.center.subScreensLabel')}</HelpBadge>
<span className="min-w-0 flex-1 text-caption text-content-muted truncate">
@@ -113,7 +113,7 @@ export default function HelpHome({ context }: { context: HelpContext | null }):
decoding="async"
className="block w-full aspect-video object-contain"
/>
<span className="absolute bottom-3 left-3">
<span className="absolute bottom-3 start-3">
<HelpBadge tone="accent" icon={Camera}>{t(ctxKey(context.id, 'title'))}</HelpBadge>
</span>
</figure>
@@ -178,7 +178,7 @@ function SubScreenCard({ screen }: { screen: HelpContext }): React.ReactElement
<button
type="button"
onClick={() => browse(current ? null : screen.id)}
className="group w-full h-full flex items-center gap-3 rounded-xl border border-edge bg-surface-secondary px-3 py-2.5 text-left hover:border-content-faint hover:bg-surface-card transition-colors"
className="group w-full h-full flex items-center gap-3 rounded-xl border border-edge bg-surface-secondary px-3 py-2.5 text-start hover:border-content-faint hover:bg-surface-card transition-colors"
>
<span className="w-9 h-9 rounded-lg bg-surface-card text-content-secondary flex items-center justify-center flex-shrink-0 group-hover:bg-accent group-hover:text-accent-text transition-colors">
<Icon className="w-4 h-4" />
@@ -214,7 +214,7 @@ export function GuideCard({ guide }: { guide: HelpGuide }): React.ReactElement {
<button
type="button"
onClick={() => openGuide(guide.id)}
className="group w-full h-full flex flex-col gap-3 rounded-2xl border border-edge bg-surface-card p-4 text-left hover:border-content-faint hover:shadow-elevated transition-[border-color,box-shadow,transform] duration-200 ease-[var(--ease-out-quint)] hover:-translate-y-px"
className="group w-full h-full flex flex-col gap-3 rounded-2xl border border-edge bg-surface-card p-4 text-start hover:border-content-faint hover:shadow-elevated transition-[border-color,box-shadow,transform] duration-200 ease-[var(--ease-out-quint)] hover:-translate-y-px"
>
<span className="flex items-center justify-between">
<span className="w-10 h-10 rounded-xl bg-surface-tertiary text-content-secondary flex items-center justify-center group-hover:bg-accent group-hover:text-accent-text transition-colors">
+1 -1
View File
@@ -22,7 +22,7 @@ export default function HelpLightbox(): React.ReactElement | null {
type="button"
onClick={() => close(null)}
aria-label={t('help.center.close')}
className="absolute top-4 right-4 w-10 h-10 rounded-full bg-inverse text-inverse-text flex items-center justify-center shadow-elevated hover:scale-105 transition-transform"
className="absolute top-4 end-4 w-10 h-10 rounded-full bg-inverse text-inverse-text flex items-center justify-center shadow-elevated hover:scale-105 transition-transform"
>
<X className="w-5 h-5" />
</button>
+12 -12
View File
@@ -41,7 +41,7 @@ export default function HelpNav({ context, currentId, activeGuideId }: {
const [familyOpen, setFamilyOpen] = useState(false)
return (
<nav className="flex flex-col min-h-0 border-b md:border-b-0 md:border-r border-edge bg-surface-secondary" aria-label={t('help.center.title')}>
<nav className="flex flex-col min-h-0 border-b md:border-b-0 md:border-e border-edge bg-surface-secondary" aria-label={t('help.center.title')}>
<div className="px-5 pt-5 pb-3 flex items-center gap-2.5">
<span className="w-8 h-8 rounded-lg flex items-center justify-center bg-accent text-accent-text">
<LifeBuoy className="w-4 h-4" />
@@ -51,7 +51,7 @@ export default function HelpNav({ context, currentId, activeGuideId }: {
<div className="px-5 pb-4">
<label className="relative block">
<Search className="w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-content-faint pointer-events-none" />
<Search className="w-4 h-4 absolute start-3 top-1/2 -translate-y-1/2 text-content-faint pointer-events-none" />
<input
ref={searchRef}
type="search"
@@ -59,7 +59,7 @@ export default function HelpNav({ context, currentId, activeGuideId }: {
onChange={e => setQuery(e.target.value)}
placeholder={t('help.center.searchPlaceholder')}
aria-label={t('help.center.searchPlaceholder')}
className="w-full rounded-xl bg-surface-card text-content text-body pl-9 pr-3 py-2.5 outline-none border border-edge focus:border-content-faint transition-colors placeholder:text-content-faint"
className="w-full rounded-xl bg-surface-card text-content text-body ps-9 pe-3 py-2.5 outline-none border border-edge focus:border-content-faint transition-colors placeholder:text-content-faint"
/>
</label>
</div>
@@ -77,7 +77,7 @@ export default function HelpNav({ context, currentId, activeGuideId }: {
type="button"
onClick={() => setFamilyOpen(o => !o)}
aria-expanded={familyOpen}
className="flex items-center gap-1.5 px-2 pb-1 text-left text-caption font-semibold uppercase tracking-[0.1em] text-content-faint hover:text-content transition-colors"
className="flex items-center gap-1.5 px-2 pb-1 text-start text-caption font-semibold uppercase tracking-[0.1em] text-content-faint hover:text-content transition-colors"
>
<span className="flex-1">{t('help.center.subScreensLabel')}</span>
<span className="text-caption font-bold tabular-nums normal-case tracking-normal">{family.length}</span>
@@ -101,7 +101,7 @@ export default function HelpNav({ context, currentId, activeGuideId }: {
type="button"
onClick={() => { closeGuide(); setQuery('') }}
aria-current={overviewActive ? 'page' : undefined}
className={`flex items-center gap-2.5 rounded-lg px-2 py-2 text-left transition-colors ${
className={`flex items-center gap-2.5 rounded-lg px-2 py-2 text-start transition-colors ${
overviewActive ? 'bg-surface-selected text-content' : 'text-content-secondary hover:bg-surface-hover hover:text-content'
}`}
>
@@ -219,7 +219,7 @@ function ScreenSwitcher({ shown, currentId }: { shown: HelpContext | null; curre
onClick={toggleList}
aria-haspopup="listbox"
aria-expanded={open}
className="w-full flex items-center gap-2.5 rounded-xl border border-edge bg-surface-card px-3 py-2.5 text-left hover:border-content-faint transition-colors"
className="w-full flex items-center gap-2.5 rounded-xl border border-edge bg-surface-card px-3 py-2.5 text-start hover:border-content-faint transition-colors"
>
<span className="w-7 h-7 rounded-md bg-accent text-accent-text flex items-center justify-center flex-shrink-0">
<ShownIcon className="w-3.5 h-3.5" />
@@ -236,7 +236,7 @@ function ScreenSwitcher({ shown, currentId }: { shown: HelpContext | null; curre
<ul
role="listbox"
aria-label={t('help.center.screens')}
className="trek-help-menu absolute left-2 right-2 top-full mt-1.5 z-10 flex flex-col gap-0.5 rounded-xl border border-edge bg-surface-card p-1.5 shadow-elevated"
className="trek-help-menu absolute inset-x-2 top-full mt-1.5 z-10 flex flex-col gap-0.5 rounded-xl border border-edge bg-surface-card p-1.5 shadow-elevated"
>
{screens.map(screen => {
const children = childHelpContexts(screen.id)
@@ -251,7 +251,7 @@ function ScreenSwitcher({ shown, currentId }: { shown: HelpContext | null; curre
group={children.length > 0 ? { expanded, count: children.length, toggle: () => setOpenGroup(expanded ? null : screen.id) } : undefined}
/>
{children.length > 0 && expanded && (
<ul role="group" className="flex flex-col gap-0.5 pl-3">
<ul role="group" className="flex flex-col gap-0.5 ps-3">
{children.map(child => (
<li key={child.id}>
<ScreenRow
@@ -296,7 +296,7 @@ function ScreenRow({
selected ? 'bg-surface-selected text-content' : 'text-content-secondary hover:bg-surface-hover hover:text-content'
}`}
>
<button type="button" onClick={onPick} className="min-w-0 flex-1 flex items-center gap-2.5 px-2 py-2 text-left">
<button type="button" onClick={onPick} className="min-w-0 flex-1 flex items-center gap-2.5 px-2 py-2 text-start">
{nested ? (
<CornerDownRight className="w-3.5 h-3.5 flex-shrink-0 text-content-faint" />
) : (
@@ -312,7 +312,7 @@ function ScreenRow({
onClick={e => { e.stopPropagation(); group.toggle() }}
aria-expanded={group.expanded}
aria-label={t('help.center.subScreens', { count: group.count })}
className="flex items-center gap-1 rounded-md mr-1.5 px-1.5 py-1 text-caption font-semibold text-content-faint hover:bg-surface-tertiary hover:text-content transition-colors"
className="flex items-center gap-1 rounded-md me-1.5 px-1.5 py-1 text-caption font-semibold text-content-faint hover:bg-surface-tertiary hover:text-content transition-colors"
>
{group.count}
<Fold className="w-3.5 h-3.5" />
@@ -332,7 +332,7 @@ function NavScreen({ screen, shown, current }: { screen: HelpContext; shown: boo
type="button"
onClick={() => browse(current ? null : screen.id)}
aria-current={shown ? 'page' : undefined}
className={`group w-full flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left transition-colors ${
className={`group w-full flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-start transition-colors ${
shown ? 'bg-surface-selected text-content' : 'text-content-secondary hover:bg-surface-hover hover:text-content'
}`}
>
@@ -360,7 +360,7 @@ function NavGuide({ guide, active }: { guide: HelpGuide; active: boolean }): Rea
type="button"
onClick={() => openGuide(guide.id)}
aria-current={active ? 'page' : undefined}
className={`group w-full flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left transition-colors ${
className={`group w-full flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-start transition-colors ${
active ? 'bg-surface-selected text-content' : 'text-content-secondary hover:bg-surface-hover hover:text-content'
}`}
>
+1 -1
View File
@@ -106,7 +106,7 @@ export default function HelpPanel(): React.ReactElement | null {
type="button"
onClick={closeHelp}
aria-label={t('help.center.close')}
className="absolute top-4 right-4 z-10 w-9 h-9 rounded-full flex items-center justify-center text-content-muted bg-surface-card border border-edge shadow-card hover:text-content hover:bg-surface-hover transition-colors"
className="absolute top-4 end-4 z-10 w-9 h-9 rounded-full flex items-center justify-center text-content-muted bg-surface-card border border-edge shadow-card hover:text-content hover:bg-surface-hover transition-colors"
>
<X className="w-4 h-4" />
</button>