diff --git a/design/system/RECIPE.md b/design/system/RECIPE.md
index a00ea8d8..d7890d62 100644
--- a/design/system/RECIPE.md
+++ b/design/system/RECIPE.md
@@ -150,7 +150,7 @@ States go in a matrix: variants down, states across.
- Each component ends with a **modes strip**: a `
` that holds one representative group of markup. The page script repeats it three times: in the other theme, the other density and the other direction. Add `docs-demo--column` to stack its content. Ids inside it are renamed in the copies.
- Dark needs no rule in a component: the tokens carry it. If a component looks wrong in dark, the fault is a raw value or a wrong token.
- Compact needs no rule either, when heights, paddings and gaps come from the tokens of section 4.
-- Right to left needs logical properties, and `fl-icon--directional` on an icon that points along the reading direction (an arrow, a chevron that means "next"). Use `:dir(rtl)` for the rare rule that must differ. A number with a separator, such as a counter, keeps its order with `unicode-bidi: plaintext`.
+- Right to left needs logical properties, and `fl-icon--directional` on an icon that points along the reading direction (an arrow, a chevron that means "next"). Use `:dir(rtl)` for the rare rule that must differ. A number with a separator, such as a counter, keeps its order with `unicode-bidi: plaintext`. So does every value, the data of the host or the words of a person: the elements in a cell of a table or in the value of a description list, and a name or a title that a part cuts with an ellipsis. The rule goes on the box that holds the text and fits it, never on one that can hold only a number, a badge or a control, which would then take left to right, nor on one that stretches across its row, which would take a short text to its far end. Its direction comes from its own text, so text in the other language keeps its punctuation in place and is cut at its own end; words of the interface follow the page. [Record 0015](../../docs/decisions/0015-text-in-the-other-direction.md) holds the rule.
## 8. The spec block
diff --git a/docs/decisions/0015-text-in-the-other-direction.md b/docs/decisions/0015-text-in-the-other-direction.md
new file mode 100644
index 00000000..28ee3095
--- /dev/null
+++ b/docs/decisions/0015-text-in-the-other-direction.md
@@ -0,0 +1,37 @@
+# 0015. Text in the other direction
+
+Status: accepted, 1 December 2026.
+
+## Context
+
+An admin in Arabic shows English titles, and one in English shows Arabic names. The Unicode bidirectional algorithm lays a piece of text out by the direction of the paragraph it is in, so an English title in a right-to-left cell is laid out from the right: a full stop or a question mark at its end moves to its start, a number in brackets lands on the wrong side, and when the title is cut with an ellipsis it loses its beginning, not its end. Some parts already set `unicode-bidi: plaintext`, which takes the direction of a paragraph from its own first strong character: the avatar, the badge, the breadcrumb, the counter of a field, the affix of an input, the names of a file drop zone, the pagination, the stat tile, the time of a timeline and the hint of a search field. A table cell, the value of a description list and the actions of a card did not, and only the breadcrumb said on which side a cut text ends (issue 172).
+
+### What was seen
+
+A page with `dir="rtl"`, a box of 160 pixels that cuts with an ellipsis, and the title "What's new in the spring release?", in Chromium:
+
+| Rule on the box | Where the text starts | What is cut |
+| --- | --- | --- |
+| none | at the right edge | its beginning, at the left; the question mark is drawn first |
+| `unicode-bidi: plaintext` | at the left edge | its end, at the right; the question mark stays last |
+| `plaintext` and `text-align: match-parent` | at the left edge | its end, at the right |
+
+A short English value in a right-to-left cell with `plaintext` sits at the left of the cell, as `dir="auto"` puts it; `text-align: match-parent` does not keep it at the right in Chromium.
+
+A box with `plaintext` and no strong character of its own takes left to right, in Chromium as the algorithm says. A right-to-left cell with `plaintext` that holds a number ("1,234") draws it at the right, with `text-align: end`, where the numbers of the column are at the left; one that holds only a badge or a ``, even with Arabic in it, puts it at the left, since an isolate is not read for the direction. The same element without `plaintext` on the cell, and with it on the badge or the `` alone, keeps the cell's alignment and isolates the value.
+
+## Decision
+
+- **A value isolates its text.** A part isolates the text it shows with `unicode-bidi: plaintext` when that text is a value: data of the host or words a person typed, whose language the library cannot know.
+- **The rule goes on the box that holds the text, never on a box that can hold only a number, a badge or a control.** Such a box would take left to right and leave its place in the page. So a cell of a table, the value of a description list and the actions of a card keep the direction of the page, and each element in them takes the direction of its own text, as `dir="auto"` does on an element: a link, a badge, a ``. The title and the line of meta of a cell are boxes of the cell's kind: they keep the page's direction, and the elements in them take their own. Text written straight into a cell or a value, with no element around it, follows the page; a host puts a value there in a ``, as the gallery does. The parts that hold a name or a title and fit it isolate their text themselves: a level of the breadcrumb, the title of a page header, the name of the navigation's site, a tag and a tag of a combobox; with the parts listed above.
+- **A box that stretches across its row follows the page.** The label of an item of a tree, of an option of a combobox, the text beside an avatar and the name of a file fill their row. With `plaintext` a short English name in a right-to-left tree went to the far end of its row, away from its icon, and a count lay against it. There the text keeps the page's direction: it stays beside its icon, and an English name in a right-to-left page that is too long for its row is cut at its beginning. This is the one case where the second rule gives way.
+- **A field follows the page.** The text a person types in an input or the field of a combobox is a value, but `plaintext` on a form control would put the caret of an empty field at the other end and move a number away from the end of its box. A host that takes text in either direction sets `dir="auto"` on the field, which the browser applies as the person types. Words of the interface are in the language of the page and are not isolated, so that they follow it: the label of a control, a help text, a message, the text of a button, a link or a heading of the navigation, a segment, the title of a card or a disclosure, a note of the bar, the choices of a select, and the words of `IFlTextProvider`. A host that puts a value in one of these isolates it itself, with `dir="auto"` on its own element.
+- **A cut value loses its own end.** Its direction is its own, so the ellipsis is where the value ends in its own direction: an English title in a right-to-left page is cut at the right, an Arabic name in a left-to-right page at the left. Its beginning, which says what it is, always shows.
+- **A value is aligned by its own direction.** As with `dir="auto"`, a short value in the other direction sits at its own start: an English title in a right-to-left cell is at the left of the cell. This is the price of the rule above for a block that holds the value directly, and the library accepts it: the other way, an inline wrapper around every value, would change the markup of every cell and every part, and cutting the beginning of a title is the worse fault.
+- **No new parameter.** A host does not choose: the rule is in the stylesheet, and a host that renders its own markup in a part gets it.
+
+## Consequences
+
+- The stylesheet sets `unicode-bidi: plaintext` on the elements in a cell of `fl-table` but its title and its meta, on the elements in those two, on the elements in the `dd` of `fl-description-list`, on the children of `fl-card__actions`, and on every part that cuts a name or a title with `text-overflow: ellipsis` and fits it. Every part that cuts its text was looked at; the parts of the interface, the boxes that stretch across their row and the form controls were left to the page.
+- Each rule has a browser test on a page with mixed text in both directions: an English value in a right-to-left page and an Arabic value in a left-to-right page keep their punctuation in place and are cut at their own end, and in the page's own language a number, a badge and the link of a title keep their place in their cell.
+- A column of a right-to-left table that holds values in both directions is not aligned on one edge. A host that wants one edge sets `unicode-bidi: normal` on those cells and puts each value in an element of its own with `dir="auto"`: the cell keeps the direction and the alignment of the page, and the value is isolated inside it. An element with `dir="auto"` alone is not enough, since Chromium takes the direction of the cell from it all the same.
diff --git a/docs/decisions/README.md b/docs/decisions/README.md
index 0bf3d1e9..7dfb993e 100644
--- a/docs/decisions/README.md
+++ b/docs/decisions/README.md
@@ -18,5 +18,6 @@ A decision record is a short document that says what was decided, why, and what
| [0012](0012-one-announcement-path.md) | One announcement path for toasts and for results that need no toast | Accepted |
| [0013](0013-dialogs-that-require-an-action.md) | Dialogs and drawers that close only by an action | Accepted |
| [0014](0014-picker-completion.md) | How a picker answers after its dialog closes | Accepted |
+| [0015](0015-text-in-the-other-direction.md) | Text in the other direction: which parts isolate it, and where a cut ends | Accepted |
A new record takes the next number. The [implementation plan](../planning/implementation-plan.md) is the larger context.
diff --git a/src/FluentCMS.Components/Styles/components/card.css b/src/FluentCMS.Components/Styles/components/card.css
index e96acdad..3940044c 100644
--- a/src/FluentCMS.Components/Styles/components/card.css
+++ b/src/FluentCMS.Components/Styles/components/card.css
@@ -48,6 +48,11 @@
gap: var(--fl-space-1);
flex: none;
font-size: var(--fl-font-size-s);
+
+ /* A link or a note among the actions takes the direction of its own text (record 0015). */
+ & > * {
+ unicode-bidi: plaintext;
+ }
}
}
diff --git a/src/FluentCMS.Components/Styles/components/combobox.css b/src/FluentCMS.Components/Styles/components/combobox.css
index 52c71884..79187f24 100644
--- a/src/FluentCMS.Components/Styles/components/combobox.css
+++ b/src/FluentCMS.Components/Styles/components/combobox.css
@@ -106,6 +106,7 @@
min-inline-size: 0;
overflow: hidden;
text-overflow: ellipsis;
+ unicode-bidi: plaintext;
}
}
diff --git a/src/FluentCMS.Components/Styles/components/navigation.css b/src/FluentCMS.Components/Styles/components/navigation.css
index 77e01ccf..bc464644 100644
--- a/src/FluentCMS.Components/Styles/components/navigation.css
+++ b/src/FluentCMS.Components/Styles/components/navigation.css
@@ -51,6 +51,7 @@
min-inline-size: 0;
overflow: hidden;
text-overflow: ellipsis;
+ unicode-bidi: plaintext;
}
&:focus-visible {
diff --git a/src/FluentCMS.Components/Styles/components/table.css b/src/FluentCMS.Components/Styles/components/table.css
index 27a102e5..523aec4b 100644
--- a/src/FluentCMS.Components/Styles/components/table.css
+++ b/src/FluentCMS.Components/Styles/components/table.css
@@ -44,6 +44,13 @@
font-weight: var(--fl-font-weight-regular);
text-align: start;
vertical-align: middle;
+ /* What a cell holds takes the direction of its own text (record 0015): its elements, and those of its title and
+ its line of meta. The cell itself keeps the direction of the page, so that a number, a badge or a control
+ keeps its place in the column. */
+ & > :not(.fl-table__title, .fl-table__meta),
+ & > :is(.fl-table__title, .fl-table__meta) > * {
+ unicode-bidi: plaintext;
+ }
}
/* The first and the last cell line up with the padding of a card. */
diff --git a/src/FluentCMS.Components/Styles/components/tag.css b/src/FluentCMS.Components/Styles/components/tag.css
index 1993d629..8db154ef 100644
--- a/src/FluentCMS.Components/Styles/components/tag.css
+++ b/src/FluentCMS.Components/Styles/components/tag.css
@@ -32,6 +32,7 @@
min-inline-size: 0;
overflow: hidden;
text-overflow: ellipsis;
+ unicode-bidi: plaintext;
white-space: nowrap;
}
diff --git a/src/FluentCMS.Components/Styles/patterns/description-list.css b/src/FluentCMS.Components/Styles/patterns/description-list.css
index 56a577ec..380a183e 100644
--- a/src/FluentCMS.Components/Styles/patterns/description-list.css
+++ b/src/FluentCMS.Components/Styles/patterns/description-list.css
@@ -39,6 +39,12 @@
min-inline-size: 0;
margin: 0;
overflow-wrap: anywhere;
+
+ /* An element of the value takes the direction of its own text; the value keeps the direction of the page
+ (record 0015). */
+ & > * {
+ unicode-bidi: plaintext;
+ }
}
@container (min-inline-size: 30rem) {
diff --git a/src/FluentCMS.Components/Styles/patterns/page-header.css b/src/FluentCMS.Components/Styles/patterns/page-header.css
index 5e679df3..a00ace24 100644
--- a/src/FluentCMS.Components/Styles/patterns/page-header.css
+++ b/src/FluentCMS.Components/Styles/patterns/page-header.css
@@ -43,6 +43,7 @@
line-height: var(--fl-line-height-tight);
overflow: hidden;
text-overflow: ellipsis;
+ unicode-bidi: plaintext;
white-space: nowrap;
}
diff --git a/tests/FluentCMS.Components.Browser/Foundations/TextDirectionTests.cs b/tests/FluentCMS.Components.Browser/Foundations/TextDirectionTests.cs
new file mode 100644
index 00000000..67601348
--- /dev/null
+++ b/tests/FluentCMS.Components.Browser/Foundations/TextDirectionTests.cs
@@ -0,0 +1,145 @@
+using FluentCMS.Components.Browser.Harness;
+using Microsoft.Playwright;
+
+namespace FluentCMS.Components.Browser.Foundations;
+
+// Record 0015: a value takes its direction from its own text. Each case puts text in the other direction into a specimen
+// of the gallery, an English title in a right-to-left page and an Arabic one in a left-to-right page, and reads where its
+// first and its last character are drawn. Static alone: the text is put in by script, which a render would not know of.
+public sealed class TextDirectionTests(GalleryFixture gallery)
+{
+ private const string English = "What's new in the spring release, our guide to publishing in many languages and regions?";
+ private const string Arabic = "ما الجديد في إصدار الربيع، دليلنا إلى النشر بلغات ومناطق كثيرة!";
+
+ // A value in a cell, in a description list, among the actions of a card and in a tag keeps the order of its own text.
+ private static readonly (string Page, string Selector)[] Values =
+ [
+ ("table", "#table-reviews > tbody > tr:first-child .fl-table__title > a"),
+ ("table", "#table-reviews > tbody > tr:first-child .fl-table__meta > *"),
+ ("patterns", "#description-list dd > *"),
+ ("card", "#card-text-action .fl-card__actions > a"),
+ ("tag", "#tag-plain .fl-tag__label"),
+ ];
+
+ // A part that cuts its text keeps the beginning of a value in the other direction.
+ private static readonly (string Page, string Selector)[] Cuts =
+ [
+ ("patterns", "#page-header .fl-page-header__title"),
+ ("breadcrumb", "#breadcrumb-narrow .fl-breadcrumb__current"),
+ ("tag", "#tag-plain .fl-tag__label"),
+ ];
+
+ private const string Measure = """
+ ([selector, text, ltr]) => {
+ // An element of a cell or of a value is what holds a value there: one is made where the specimen has text alone.
+ const [outer, inner] = selector.split(' > *');
+ let el = document.querySelector(inner === undefined ? selector : outer + ' > *');
+ if (inner !== undefined && !el) {
+ const host = document.querySelector(outer);
+ if (host) { host.textContent = ''; el = host.appendChild(document.createElement('span')); }
+ }
+ if (!el) return [true, false, false, false];
+ el.textContent = text;
+ const node = el.firstChild;
+ const at = i => { const range = document.createRange(); range.setStart(node, i); range.setEnd(node, i + 1); return range.getBoundingClientRect(); };
+ const first = at(0), last = at(text.length - 1), box = el.getBoundingClientRect();
+ // Missing, laid out in its own direction, beginning shown, cut.
+ return [false, ltr ? last.left > first.left : last.left < first.left,
+ first.left >= box.left - 1 && first.right <= box.right + 1, el.scrollWidth > el.clientWidth + 1];
+ }
+ """;
+
+ private sealed record Seen(bool Missing, bool Ordered, bool StartShown, bool Cut);
+
+ private async Task> CheckAsync(RenderMode mode, (string Page, string Selector)[] cases, int width, bool mustCut)
+ {
+ List faults = [];
+ foreach ((string direction, string text, bool ltr) in new[] { ("rtl", English, true), ("ltr", Arabic, false) })
+ {
+ foreach (IGrouping page in cases.GroupBy(c => c.Page))
+ {
+ await using GalleryPage sample = await gallery.OpenAsync(mode, page.Key, new() { Direction = direction, Width = width });
+ foreach ((_, string selector) in page)
+ {
+ bool[] read = await sample.Page.EvaluateAsync(Measure, new object[] { selector, text, ltr });
+ Seen seen = new(read[0], read[1], read[2], read[3]);
+ string where = $"{selector} on {page.Key}, page {direction}";
+ if (seen.Missing)
+ {
+ faults.Add($"{where}: no such element");
+ continue;
+ }
+ if (!seen.Ordered)
+ {
+ faults.Add($"{where}: the text is not laid out in its own direction");
+ }
+ if (mustCut && !seen.Cut)
+ {
+ faults.Add($"{where}: the text is not cut, so the case proves nothing");
+ }
+ if (seen.Cut && !seen.StartShown)
+ {
+ faults.Add($"{where}: the cut took the beginning of the text");
+ }
+ }
+ }
+ }
+ return faults;
+ }
+
+ [Theory]
+ [ModeData(RenderMode.Static)]
+ public async Task AValueKeepsTheOrderOfItsOwnText(RenderMode mode) => AssertNone(await CheckAsync(mode, Values, 1280, mustCut: false));
+
+ [Theory]
+ [ModeData(RenderMode.Static)]
+ public async Task ACutValueLosesItsOwnEnd(RenderMode mode) => AssertNone(await CheckAsync(mode, Cuts, 320, mustCut: true));
+
+ // In the page's own language a cell keeps the direction of the page: a number stays at the end of its column, and
+ // a badge and the link of a title at its start, though each of them takes the direction of its own text.
+ [Theory]
+ [ModeData(RenderMode.Static)]
+ public async Task ACellKeepsThePlaceOfWhatItHoldsInThePagesDirection(RenderMode mode)
+ {
+ await using GalleryPage sample = await gallery.OpenAsync(mode, "table", new() { Direction = "rtl" });
+ bool[] read = await sample.Page.EvaluateAsync("""
+ () => {
+ const row = document.querySelector('#table-reviews > tbody > tr:first-child');
+ row.querySelector('.fl-table__title > a').textContent = 'الربيع';
+ // Where a box sits in its cell of a right-to-left table: nearer its right edge is the start. Only a clear margin counts.
+ const box = el => { if (el.nodeType === Node.ELEMENT_NODE && !el.matches('td, th')) return el.getBoundingClientRect(); const r = document.createRange(); r.selectNodeContents(el); return r.getBoundingClientRect(); };
+ const side = (cell, el) => { const c = cell.getBoundingClientRect(), b = box(el), start = c.right - b.right, end = b.left - c.left; return start + 8 < end ? 'start' : end + 8 < start ? 'end' : 'unclear'; };
+ const number = row.querySelector('.fl-table__num');
+ const numberText = number;
+ const title = row.querySelector('.fl-table__title > a');
+ const badge = row.querySelector('td .fl-badge');
+ return [side(number, numberText) === 'end', side(title.closest('td, th'), title) === 'start', side(badge.closest('td'), badge) === 'start'];
+ }
+ """);
+ Assert.True(read[0], "The number left the end of its column.");
+ Assert.True(read[1], "The title in the page's language left the start of its cell.");
+ Assert.True(read[2], "The badge left the start of its cell.");
+ }
+
+ // A box that stretches across its row keeps the page's direction, so a short name in the other language stays at
+ // the start of its row, beside its icon (record 0015).
+ [Theory]
+ [ModeData(RenderMode.Static)]
+ public async Task AStretchedLabelKeepsItsTextAtTheStartOfItsRow(RenderMode mode)
+ {
+ await using GalleryPage sample = await gallery.OpenAsync(mode, "tree", new() { Direction = "rtl" });
+ bool atStart = await sample.Page.Locator("#tree-files .fl-tree__label").First.EvaluateAsync("""
+ label => { label.textContent = 'Projects'; const r = document.createRange(); r.selectNodeContents(label);
+ const text = r.getBoundingClientRect(), box = label.getBoundingClientRect(); return box.right - text.right < 1; }
+ """);
+ Assert.True(atStart, "A short English name in a right-to-left tree left the start of its row.");
+ }
+
+ private static void AssertNone(List faults)
+ {
+ if (faults.Count > 0)
+ {
+ Assert.Fail(string.Join(Environment.NewLine, faults));
+ }
+ }
+}
diff --git a/tests/FluentCMS.Components.Browser/Visual/Baselines/dashboard/content.server.dark-compact-rtl.png b/tests/FluentCMS.Components.Browser/Visual/Baselines/dashboard/content.server.dark-compact-rtl.png
index 0d72f9c2..b052ada3 100644
Binary files a/tests/FluentCMS.Components.Browser/Visual/Baselines/dashboard/content.server.dark-compact-rtl.png and b/tests/FluentCMS.Components.Browser/Visual/Baselines/dashboard/content.server.dark-compact-rtl.png differ
diff --git a/tests/FluentCMS.Components.Browser/Visual/Baselines/dashboard/window.server.dark-compact-rtl.png b/tests/FluentCMS.Components.Browser/Visual/Baselines/dashboard/window.server.dark-compact-rtl.png
index 3d74d835..3cf04961 100644
Binary files a/tests/FluentCMS.Components.Browser/Visual/Baselines/dashboard/window.server.dark-compact-rtl.png and b/tests/FluentCMS.Components.Browser/Visual/Baselines/dashboard/window.server.dark-compact-rtl.png differ
diff --git a/tests/FluentCMS.Components.Browser/Visual/Baselines/patterns/page-header-1.static.dark-compact-rtl.png b/tests/FluentCMS.Components.Browser/Visual/Baselines/patterns/page-header-1.static.dark-compact-rtl.png
index cb99e6bb..cb0360fc 100644
Binary files a/tests/FluentCMS.Components.Browser/Visual/Baselines/patterns/page-header-1.static.dark-compact-rtl.png and b/tests/FluentCMS.Components.Browser/Visual/Baselines/patterns/page-header-1.static.dark-compact-rtl.png differ
diff --git a/tests/FluentCMS.Components.Browser/Visual/Baselines/table/table-states-1.static.dark-compact-rtl.png b/tests/FluentCMS.Components.Browser/Visual/Baselines/table/table-states-1.static.dark-compact-rtl.png
index 572289d7..2798ecfe 100644
Binary files a/tests/FluentCMS.Components.Browser/Visual/Baselines/table/table-states-1.static.dark-compact-rtl.png and b/tests/FluentCMS.Components.Browser/Visual/Baselines/table/table-states-1.static.dark-compact-rtl.png differ
diff --git a/tests/FluentCMS.Components.Browser/Visual/Baselines/tag/wrap-1.static.dark-compact-rtl.png b/tests/FluentCMS.Components.Browser/Visual/Baselines/tag/wrap-1.static.dark-compact-rtl.png
index 9a239ae9..ffc32f36 100644
Binary files a/tests/FluentCMS.Components.Browser/Visual/Baselines/tag/wrap-1.static.dark-compact-rtl.png and b/tests/FluentCMS.Components.Browser/Visual/Baselines/tag/wrap-1.static.dark-compact-rtl.png differ