Skip to content

fix: resolve mobile reversed text alignment issue - #9

Merged
chtnnh merged 3 commits into
chtnnh:mainfrom
pankajsinghdeveloper26:fix-mirroring
Aug 7, 2026
Merged

fix: resolve mobile reversed text alignment issue#9
chtnnh merged 3 commits into
chtnnh:mainfrom
pankajsinghdeveloper26:fix-mirroring

Conversation

@pankajsinghdeveloper26

Copy link
Copy Markdown

Description

Fixed a UI issue where chat messages rendered in reverse/mirrored text order on mobile devices.

Changes

  • Enforced explicit dir="ltr" and [direction:ltr] attributes on the message container and individual message wrappers in emoji-chat.tsx.
  • Applied [transform:none] and explicit text-left alignment to prevent mobile viewport layout transforms.

@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

@itspankajdeveloper is attempting to deploy a commit to the chtnnh's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
together-web Skipped Skipped Aug 7, 2026 7:20pm

Repository owner deleted a comment from cursor Bot Aug 6, 2026

@chtnnh chtnnh left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this, @pankajsinghdeveloper26 — and welcome to the repo. This is a strong first GitHub PR: focused scope, a clear description, and all CI checks green (lint, typecheck, E2E, visual, Vercel preview). Bugbot also reported no bugs on the diff. Nice work.

The fix direction looks right for the reported issue. Below is everything we noticed so you can land a quick follow-up (or we can merge with a small cleanup on our side).


What looks good

  • dir="ltr" on the message list — sensible fix when chat text inherits RTL on some mobile locales even though the app is English.
  • inline-block on the message body span — helps when @mention parsing splits a line into mixed text + <span> nodes (common bidi/WebKit edge case).
  • Scope — one file, chat-only; existing tests still pass.

Suggested changes (direct fixes)

1. Trim redundant CSS (keep the fix, drop the noise)

dir="ltr" already sets direction. These are redundant or speculative:

  • Remove [direction:ltr] wherever you also have dir="ltr".
  • Remove [transform:none] — nothing in our chat stack applies transforms to message text.
  • text-left is optional; fine to keep on the container, but you don’t need it on every nested element.

Minimal pattern we’d prefer:

// Scroll container
<div
  ref={containerRef}
  onScroll={handleScroll}
  dir="ltr"
  className="min-h-0 flex-1 overflow-y-auto p-3 space-y-2"
>

// Per message — one dir on the row is enough
<div
  key={msg.id}
  dir="ltr"
  className={`text-sm ${mentionedYou ? "rounded-md bg-[var(--accent)]/10 px-2 py-1" : ""}`}
>
  ...
  <span className="inline-block [unicode-bidi:isolate]">
    {renderMessageBody(msg.body, currentParticipantId, participants)}
  </span>
</div>

([unicode-bidi:isolate] is optional but a bit cleaner than stacking dir on three levels.)

2. Revert unrelated formatting churn

Please undo style-only edits so the diff stays easy to review:

  • Trailing comma removals (e.g. </span>,</span>)
  • createPortal(..., document.body) comma change
  • mentionMatches filter formatting
  • <form> attribute line break

Also restore the newline at EOF on emoji-chat.tsx.

3. Chat input — was typing affected too?

This PR only touches ChatMessages, not ChatInput. If the mirrored/reversed text also happened while typing in the input, add the same fix there:

<input
  ...
  dir="ltr"
  className="min-w-0 flex-1 ... text-left"
/>

If input was fine and only rendered messages were wrong, a one-line note in the PR description is enough.

4. Optional follow-up (not blocking)

  • dir="ltr" on <html lang="en"> in layout.tsx would fix RTL inheritance app-wide; chat-only dir is fine for this PR.
  • Longer term, dir="auto" per message would respect Arabic/Hebrew chat; forcing LTR everywhere is OK for our English-first UI for now.

Regression / product notes (for your awareness)

Area Risk
@mentions, emoji Low
Mobile keyboard / scroll None (no layout changes)
Desktop sidebar chat Low (same component)
RTL-language chat messages Forced LTR won’t auto-flow RTL — acceptable for us today

We don’t expect a Playwright test for bidi mirroring; manual check on a device/locale where you saw the bug is the best verification.


Summary

Verdict: Approve in principle — please push a small cleanup (items 1–2, and 3 if input was affected). Happy to merge right after that.

Thanks again for contributing — hope to see more from you.

@chtnnh chtnnh left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mobile mirroring symptom is real, but this fix is too local and mixes unrelated formatting churn. Please address the root cause once (document/layout direction), add regression coverage, and drop the redundant per-node overrides.

ref={containerRef}
onScroll={handleScroll}
className="min-h-0 flex-1 overflow-y-auto p-3 space-y-2"
dir="ltr"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stacking dir="ltr" + [direction:ltr] on the scroll container is redundant — pick one mechanism. More importantly, if chat should always be LTR, set dir="ltr" on <html> in layout.tsx (or a room-level wrapper) instead of sprinkling it through every message node.

key={msg.id}
className={`text-sm ${mentionedYou ? "rounded-md bg-[var(--accent)]/10 px-2 py-1" : ""}`}
dir="ltr"
className={`text-sm text-left [direction:ltr] [transform:none] ${

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[transform:none] on three nested wrappers is unlikely to fix reversed glyph order (that’s a bidi/direction issue, not a CSS transform). Can you confirm this was tested on the failing device, or remove it if it’s speculative?

<span className="font-medium text-[var(--accent)]">{msg.senderName}</span>
<span className="mx-1 text-[var(--text-muted)]">·</span>
<span>{renderMessageBody(msg.body, currentParticipantId, participants)}</span>
<span dir="ltr" className="inline-block [direction:ltr] [transform:none]">

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Third layer of dir="ltr" on the body span — if we need this depth, the fix is probably at the wrong layer. Prefer one explicit LTR island at the chat panel root (ChatMessages + ChatInput) rather than per-message + per-span.

Comment thread apps/web/src/components/emoji-chat.tsx Outdated
>
@{matched.displayName}
</span>,
</span>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated trailing-comma removals (</span>,</span>) and formatting-only edits elsewhere in the file add review noise. Please revert anything that isn’t required for the mirroring fix.

</ul>
)}
</form>
);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File now ends without a trailing newline — Biome/CI will flag this once --error-on-warnings is enabled on the merge-gate branch.

@chtnnh

chtnnh commented Aug 7, 2026

Copy link
Copy Markdown
Owner

just commenting to see if CI gets triggered by this :/

Resolve emoji-chat.tsx conflicts by keeping main (RTL/dir=ltr fixes
and merge-gate chat refactors already cover the mirroring issue).
@chtnnh
chtnnh merged commit 6911c30 into chtnnh:main Aug 7, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants