fix(session-ui): escape direction:rtl bidi issue in message-part-directory via LRE/PDF wraps#36487
fix(session-ui): escape direction:rtl bidi issue in message-part-directory via LRE/PDF wraps#36487windlandneko wants to merge 1 commit into
Conversation
…ctory via LRE/PDF wraps When direction: rtl is applied to a path starting with a leading dot (e.g. .config/opencode/), the Unicode bidirectional algorithm misplaces the dot, rendering it as /config/opencode./ in some browsers. This is a known issue with the direction: rtl + text-overflow: ellipsis trick for showing the end of a truncated path. The same approach used in apply-patch-directory (wrapping text in LRE \u202A / PDF \u202C Unicode control characters) is applied to message-part-directory to force LTR embedding inside the RTL context.
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a UI rendering issue where RTL direction + ellipsis truncation can cause leading-dot directories (e.g. .config/...) to be reordered incorrectly by the Unicode bidi algorithm. It does so by forcing an LTR embedding for the directory segment inside the RTL container, matching an existing pattern already used elsewhere in the same component.
Changes:
- Wrap
message-part-directorydirectory text with Unicode LRE (\u202A) / PDF (\u202C) control characters at all three usage sites. - Align behavior with existing
apply-patch-directoryhandling in the same file.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Problem
When
direction: rtl+text-overflow: ellipsisis applied to a path starting with a leading dot (e.g..config/opencode/), the Unicode bidirectional algorithm misplaces the dot, rendering it as/config/opencode./in some browsers. This is a known issue with thedirection: rtltrick for showing the end of a truncated path.Fix
Wrap the directory text in LRE (
\u202A) / PDF (\u202C) Unicode control characters, exactly as already done forapply-patch-directoryin the same file (lines 1458, 2338) and forsession-review-directoryinsession-review.tsx.This forces LTR embedding inside the RTL context, preventing the bidi algorithm from misplacing leading dot characters.
Changes
packages/session-ui/src/components/message-part.tsx: WrapgetDirectory()output in LRE/PDF at all 3message-part-directoryusage sites (edit-trigger, write-trigger, and patch tool).