Skip to content

msglist: Use directional positioning for unread marker in RTL#1991

Merged
gnprice merged 1 commit intozulip:mainfrom
yash-agarwa-l:fix-rtl-unread-marker
Nov 25, 2025
Merged

msglist: Use directional positioning for unread marker in RTL#1991
gnprice merged 1 commit intozulip:mainfrom
yash-agarwa-l:fix-rtl-unread-marker

Conversation

@yash-agarwa-l
Copy link
Contributor

@yash-agarwa-l yash-agarwa-l commented Nov 18, 2025

Fixes #1245

This PR corrects the unread-marker alignment in RTL layouts.

Problem:
_UnreadMarker used LTR-specific properties (left: 0, Border(left: …)), causing the unread marker to always appear on the left, even for RTL languages like Arabic.

Fix
Therefore Replaced LTR-specific properties with directional equivalents:
PositionedDirectional(start: 0)
BorderDirectional(start: BorderSide(...))

This ensures the unread marker appears on the correct “start” side based on text direction.

Manually tested by setting:
locale: Locale('ar')

Verified correct behavior in both LTR and RTL layouts (screenshots included).

Before

LTR

LTR

RTL

RTL

After

LTR

LTR

RTL

RTL

Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

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

Thanks! Small comments below.

Also:

  • Please say Fixes #1245. in the commit message. For examples, use Greg's "secret" to using git log -p.
  • Please also post screenshots of what it looks like before this change, so we can see clearly the improvement being made. 🙂

}
}


Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here.

Comment on lines +1659 to +1665
)),
),
),
),
),
],
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This code-style change is unrelated and unhelpful; please remove it.

@chrisbobbe chrisbobbe self-assigned this Nov 18, 2025
@chrisbobbe chrisbobbe added the maintainer review PR ready for review by Zulip maintainers label Nov 18, 2025
@yash-agarwa-l yash-agarwa-l changed the title msglist: Use directional positioning for unread marker in RTL. msglist: Use directional positioning for unread marker in RTL (Fixes #1245) Nov 18, 2025
@yash-agarwa-l
Copy link
Contributor Author

Thank you for the feedback.
I’ve cleaned up the commit and added the before screenshots as requested.
Please let me know if there’s anything else I should adjust.

@chrisbobbe
Copy link
Collaborator

Bump on this part:

@yash-agarwa-l
Copy link
Contributor Author

Thank You, I've updated the commit and pushed the revision.

@chrisbobbe
Copy link
Collaborator

Please write it according to the project style; the Fixes #1245. line belongs in the commit-message body, not in the summary line.

@yash-agarwa-l yash-agarwa-l changed the title msglist: Use directional positioning for unread marker in RTL (Fixes #1245) msglist: Use directional positioning for unread marker in RTL Nov 19, 2025
@yash-agarwa-l
Copy link
Contributor Author

Thanks for the clarification, updated.

@chrisbobbe chrisbobbe requested a review from gnprice November 19, 2025 04:18
@chrisbobbe chrisbobbe added integration review Added by maintainers when PR may be ready for integration and removed maintainer review PR ready for review by Zulip maintainers labels Nov 19, 2025
@chrisbobbe
Copy link
Collaborator

Thanks! Marked for Greg's review.

Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

Thanks @yash-agarwa-l for taking care of this, and thanks @chrisbobbe for the previous reviews!

Those before/after screenshots in particular are very helpful, thanks. It's especially helpful that they're very clean — the before and after differ only in the one way that's relevant.

This looks good; merging. One commit-message nit which I'll fix up:

-    msglist: Use directional positioning for unread marker in RTL.
+    msglist: Use directional positioning for unread marker in RTL

In this repo we don't use a trailing period on the summary line of a commit message.

@gnprice gnprice force-pushed the fix-rtl-unread-marker branch from df5ae40 to 49d6226 Compare November 25, 2025 03:36
@gnprice gnprice merged commit 49d6226 into zulip:main Nov 25, 2025
@gnprice
Copy link
Member

gnprice commented Nov 25, 2025

I also just did a quick audit with git grep left: and git grep right: to look for other similar places to be fixed. (More precisely: git grep -iP 'left:|right:' lib/. Some matches for that query treat left and right symmetrically already, so those are fine.)

I found 4 of them:

  • The formatting on block quotations (the Quotation widget).

  • The display of images and video thumbnails in the message list. That's the MessageMediaContainer, here:

      child: UnconstrainedBox(
        alignment: Alignment.centerLeft,
        child: Padding(
          // TODO clean up this padding by imitating web less precisely;
          //   in particular, avoid adding loose whitespace at end of message.
          padding: const EdgeInsets.only(right: 5, bottom: 5),

@yash-agarwa-l if you're looking for more issues to work on for contributing to Zulip, I think those would be a good list to pick up while this area is fresh in your mind from doing this issue.

I'd suggest going in the order listed above — the quotes in particular I would guess look pretty wrong right now. And then a key element in a PR for any of these will be to post good before/after screenshots that clearly show the change, just like you did on this PR.

@yash-agarwa-l
Copy link
Contributor Author

Thanks so much for the review, the merge, and especially for auditing the code for these related RTL issues!

I'm really happy contributing to Zulip. I'll start working through that list, beginning with the block quotations (Quotation widget), and will keep all your feedback in mind for the new PR.

@gnprice
Copy link
Member

gnprice commented Dec 12, 2025

Looking at the screenshots in #2005, there's one other discrepancy I notice (in main, not new in that PR):

  • The "TODAY" in a recipient header is nicely aligned with the timestamps on individual messages in an LTR layout, but it's closer to the edge of the screen in an RTL layout.

That isn't one of the places I found in my comment above. It looks like that's due to one more pattern to search for: git grep LTRB lib/. Those are fine when the "left" and "right" arguments are equal, but should be converted to STEB when they're different. Looking at the results, there's just one of them to be fixed, happily — the same one that causes the discrepancy I spotted in the screenshots.

@yash-agarwa-l
Copy link
Contributor Author

Thanks! I ran git grep LTRB lib/ and found the one instance where the left and right values differed. I've opened PR #2038 to fix it.

gnprice pushed a commit to yash-agarwa-l/zulip-flutter that referenced this pull request Dec 27, 2025
Switch to EdgeInsetsDirectional from EdgeInserts for
recipent header date, it fixes the alignment in RTL layouts.

Fixes the issue described here:
  zulip#1991 (comment)
@gnprice
Copy link
Member

gnprice commented Jan 2, 2026

@yash-agarwa-l Thanks again for all these fixes! Rerunning the search from #1991 (comment) now that the items mentioned there are all fixed, I find one more case which I missed earlier:

  • In showing ScrollToBottomButton, we place it at the bottom and right of the message list. It should be at the bottom and end.

Would you be up for taking care of that? With good clear screenshots and a test, like you've been doing for these other issues.

yash-agarwa-l added a commit to yash-agarwa-l/zulip-flutter that referenced this pull request Jan 3, 2026
Previously, the `ScrollToBottomButton` was stuck on the right even
in RTL layouts. This fixes it to work correctly in both RTL and LTR.

Fixes the issue described here:
zulip#1991 (comment)
@yash-agarwa-l
Copy link
Contributor Author

Sure, happy to take care of that! I've made a PR for this fix (#2063) with the screenshots attached.

@gnprice
Copy link
Member

gnprice commented Jan 9, 2026

OK, now that all those are fixed (thanks again @yash-agarwa-l!), I've gone and done a more comprehensive search: git grep -iP 'left|right' lib/. Most of the remaining matches are perfectly fine — including comments using the word "right" meaning "correct", or "left" meaning "remaining".

There are just two now that I think are suspect:

  • In _AutocompleteFieldState, we have an Align with alignment: Alignment.bottomLeft. I expect this affects where the autocomplete results are shown.
  • In UnicodeEmojiWidget, we have a Stack with alignment: Alignment.centerLeft. I expect this affects how Unicode emoji appear on iOS.

There are also a few classes of matches which look suspicious on their face, but I think are fine:

  • In KaTeX content, several bits that translate layout directly from the KaTeX HTML which also uses "left" and "right". Similarly TableColumnTextAlignment in other content.
  • Calls to the String.padLeft method, which would more aptly be named padStart.
  • Icons with "left" and/or "right" in their names. We've already caused those to effectively mean "start" and "end", with icons: Add matchTextDirection to directional icons #2015.

@yash-agarwa-l would you be up for resolving those last two cases?

If you don't have a Mac for development then I think you won't be able to effectively test the second one — it relates to the idiosyncratic properties of Apple's proprietary emoji font. In that case we'll just leave that one for someone else to pick up.

@yash-agarwa-l yash-agarwa-l deleted the fix-rtl-unread-marker branch January 9, 2026 14:51
@yash-agarwa-l
Copy link
Contributor Author

Thanks! I'll take care of both of those. I do have a Mac, so I can properly test the UnicodeEmojiWidget changes as well.

yash-agarwa-l added a commit to yash-agarwa-l/zulip-flutter that referenced this pull request Jan 10, 2026
On iOS and macOS, use AlignmentDirectional.centerStart instead of
Alignment.centerLeft for the Stack containing Unicode emoji.

Fixes the issue described here:
zulip#1991 (comment)
yash-agarwa-l added a commit to yash-agarwa-l/zulip-flutter that referenced this pull request Jan 10, 2026
On iOS and macOS, use AlignmentDirectional.centerStart instead of
Alignment.centerLeft for the Stack containing Unicode emoji.

Fixes the issue described here:
zulip#1991 (comment)
yash-agarwa-l added a commit to yash-agarwa-l/zulip-flutter that referenced this pull request Jan 10, 2026
On iOS and macOS, use AlignmentDirectional.centerStart instead of
Alignment.centerLeft for the Stack containing Unicode emoji.

Fixes the issue described here:
zulip#1991 (comment)
yash-agarwa-l added a commit to yash-agarwa-l/zulip-flutter that referenced this pull request Jan 10, 2026
Use AlignmentDirectional.bottomStart instead of Alignment.bottomLeft
for the autocomplete dropdown positioning. This ensures the dropdown
alignment respects text direction in RTL layouts.

Fixes the issue described here:
zulip#1991 (comment)
gnprice pushed a commit to yash-agarwa-l/zulip-flutter that referenced this pull request Feb 5, 2026
Use AlignmentDirectional.bottomStart instead of Alignment.bottomLeft
for the autocomplete dropdown positioning. This ensures the dropdown
alignment respects text direction in RTL layouts.

This doesn't currently cause any change in user-visible behavior,
because the autocomplete popup has the same width as the text input
and so both the left and right edges are already aligned.

Fixes the issue described here:
zulip#1991 (comment)
yash-agarwa-l added a commit to yash-agarwa-l/zulip-flutter that referenced this pull request Feb 21, 2026
Fixes zulip#1991.

Use the email_auth_enabled server setting to conditionally render
the username/password fields and the alternative auth divider.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration review Added by maintainers when PR may be ready for integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

msglist: Vertical message-unread marker should be "start"-positioned, not "left"

3 participants