Repository navigation
fix(chat): right-align Arabic assistant replies with logical text-align - #2639
Conversation
Markdown blocks already set dir from majority script (vastsa#2388), but only user bubbles used text-align: start. A physical text-align: left inherited from an ancestor or a platform default kept Arabic-only replies left-aligned even when dir=rtl was set. Apply the same logical alignment to Markdown paragraphs, lists, headings, and blockquotes, and give headings and quotes the same majority-script dir. List padding uses padding-inline-start so RTL lists indent from the right. Fixes vastsa#2635
There was a problem hiding this comment.
AIUO CodePilot · Preliminary review
Diff-only preliminary review of PR #2639. The change extends majority-script `dir` and logical `text-align: start` to Markdown paragraphs, list items, headings, and blockquotes, switches list padding to logical properties, and stops spreading hast `node` onto the DOM. No concrete added-line defect is evidenced from the patch alone. Verify on a renderer build that nested Markdown blocks retain intended alignment and that `getComputedStyle().textAlign` exposes the expected value across supported engines.
No evidenced findings in the supplied diff.
Head: cd93b21
Base: 6214e55
CI: success; mergeable: true.
Validation: code/tests NOT EXECUTED. Diff-only preliminary analysis; not approval. Human review and repository gates remain required.
vastsa
left a comment
There was a problem hiding this comment.
I ran all 40 focused Markdown/direction tests on the integration candidate 4f6638a2e (base 6214e5583, head cd93b21a1). In a separate Chromium probe using the production Markdown renderer and prose stylesheet, an Arabic-only paragraph aligned right on both revisions by default. With an ancestor explicitly set to text-align: left, the old paragraph aligned left and the candidate aligned right. That confirms the inheritance fix, but does not independently reproduce the reported Windows path.
The proposed RTL list indentation is still incomplete. In a pure Arabic two-item list under the usual LTR prose container, the candidate <li> computes direction: rtl, but <ul> still computes direction: ltr with padding-left: 22.4px and padding-right: 0px (same as main). The logical padding is on the container, so changing only the item direction leaves the list gutter on the opposite side from RTL list content. The current direction/alignment assertions do not exercise that geometry.
Please either keep the patch focused on paragraph alignment and leave list indentation out, or set the direction on the list container where appropriate and add a browser geometry assertion for pure RTL and ordinary LTR lists. Please also make the paragraph regression exercise the actual inherited alignment (or document what reproduces the Windows case), and verify glyph placement rather than accepting computed start alone.
Place dir on ul/ol from the list's majority script so padding-inline-start sits on the same side as RTL items. The bidi probe now asserts list padding geometry and that an Arabic paragraph stays visually right-aligned when an ancestor uses physical text-align:left. Fixes vastsa#2635
vastsa
left a comment
There was a problem hiding this comment.
I verified the follow-up on GitHub’s integration candidate abf4e6345 (base 6214e5583, head 210cb0523): 40 Markdown/direction tests, the PR base check, a renderer build, and the Chromium bidi probe passed on macOS. Glyph placement under an explicitly left-aligned ancestor and both RTL/LTR list gutters are now covered; the earlier gutter finding is resolved. The architecture check passed with an oversized-file growth warning. The full local desktop build did not complete because the provisioned agent-runtime dependency could not resolve @earendil-works/pi-ai/utils/hosted-search.
What remains is the scope of Fixes #2635: the probe applies text-align: left itself, so it does not show that the reported Windows chat path gets that inherited alignment in production. Please provide a before/after run of that Windows path, or describe this as the verified inherited-alignment fix and leave #2635 open until that path is confirmed. Please also update the relevant renderer spec / E2E scenario for the assistant alignment and list-gutter behavior.
Describe the MessageBubble assistant contract as physical row placement plus text-align:start under a majority-script dir. Add E2E-060d for that alignment and list-gutter behavior. This PR is the verified inherited-alignment fix; leave vastsa#2635 open until the reported Windows chat path is confirmed. Refs vastsa#2635
vastsa
left a comment
There was a problem hiding this comment.
Verified aa3797cd8 on GitHub integration candidate eaee496a1 (base 6214e5583). All 40 focused tests passed, as did the PR-base check and the Chromium probe (RTL glyph placement under an explicitly left-aligned ancestor and RTL/LTR list gutters). The renderer build and probe used the candidate shared source because the provisioned shared dist is stale; the full local build remains blocked by hosted-search dependency resolution. All six GitHub checks on this revision passed. The spec and scenario now describe the narrower behavior, and #2635 stays open for the unverified Windows path.
Ported from vastsa/PI-Desktop v0.24.0-beta.7 (bug fixes only; the release's features were left for a later rebase): vastsa#2625 quarantine rejected outbox appends instead of retrying them forever vastsa#2574 settle live turns and tool rows when the sidecar dies mid-stream vastsa#2578 native Pi turns stay stoppable after a reload vastsa#2634 the task badge mirrors work that is still running vastsa#2639 let Arabic and Hebrew paragraphs choose their own side vastsa#2640 stop a renderer crash loop with one GPU-less relaunch, then a dialog vastsa#2642 reject differing spellings of one tool argument vastsa#2655 compaction summaries open on demand in the transcript
Summary
#2389 already set each Markdown block's
dirfrom the majority strong script, and usedtext-align: starton user message paragraphs. Assistant replies go through Markdown, which setdironly. When a physicaltext-align: leftis inherited (or used as a platform default), an Arabic-only reply stays left-aligned even withdir="rtl".This applies the same logical alignment to Markdown paragraphs, lists, headings, and blockquotes, and gives headings and quotes the same majority-script
dir. List padding usespadding-inline-startso RTL lists indent from the right. List containers also receive thatdirso the gutter follows the list rather than the surrounding paragraph. The hastnodeprop is no longer spread onto the DOM.This is the verified inherited-alignment fix: the Chromium probe confirms glyph placement and RTL/LTR list gutters under an explicit
text-align: leftancestor. The probe applies that ancestor itself, so it does not show that the reported Windows chat path in #2635 inherits that alignment in production. Refs #2635 — leave the issue open until that path is confirmed.The MessageBubble assistant contract and E2E-060d now describe this alignment and list-gutter behavior.
Test plan
node --test test/markdown-bidi-alignment.test.mjs test/markdown-*.test.mjs test/text-direction.test.mjs(40 passed)tsc --noEmitand style-token check passedscripts/e2e-bidi.mjsChromium probe: inheritedtext-align: leftglyph placement and RTL/LTR list guttersdocs/spec/04-ux/08-component-spec.md§8.3 anddocs/spec/06-delivery/e2e/ui-shell.mdE2E-060dRefs #2635