Skip to content

autocomplete: Use directional alignment for autocomplete results#2070

Merged
gnprice merged 1 commit intozulip:mainfrom
yash-agarwa-l:fix-rtl-field
Feb 5, 2026
Merged

autocomplete: Use directional alignment for autocomplete results#2070
gnprice merged 1 commit intozulip:mainfrom
yash-agarwa-l:fix-rtl-field

Conversation

@yash-agarwa-l
Copy link
Contributor

@yash-agarwa-l yash-agarwa-l commented 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.

The autocomplete dropdown spans the full available width, so Align has no extra space to reposition it—making bottomStart vs bottomLeft visually identical despite the directional correctness fix.

Fixes the issue described here:
#1991 (comment)

Before

LTR

LTR

RTL

RTL

After

LTR

LTR

RTL

RTL

@gnprice gnprice added the maintainer review PR ready for review by Zulip maintainers label Jan 14, 2026
@chrisbobbe
Copy link
Collaborator

Thanks, @yash-agarwa-l! I don't see a difference between the "before" and "after" screenshots. That doesn't mean it's a bad change (certainly it seems more correct to use AlignmentDirectional!), but it would be great to have visual evidence of a user-facing benefit if we can. 🙂 Can you spend some time trying to produce such evidence, or else to explain why it's just a latent bug? In either case, the code looks like an improvement, so I'll mark for Greg's review.

@chrisbobbe chrisbobbe assigned gnprice and unassigned chrisbobbe Jan 15, 2026
@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 Jan 15, 2026
@chrisbobbe chrisbobbe requested a review from gnprice January 15, 2026 21:09
@yash-agarwa-l
Copy link
Contributor Author

yash-agarwa-l commented Jan 16, 2026

Thanks! The likely reason is because the width of autocomplete dropdown spans the full screen width.
Since Align can only position its child within the space it’s given, there is no actual visual difference between using bottomStart vs bottomLeft, because the dropdown is already filling the available width.

@gnprice
Copy link
Member

gnprice commented Jan 24, 2026

Thanks!

For verifying the effect on behavior, what happens if the screen is much wider? Perhaps that would cause the behavior to differ, by making the input wider than the autocomplete popup is.

For users in real life, the most likely way that would happen is if they're using a tablet. For testing, an often very convenient way to test layout behavior on different screen sizes and shapes is to run a desktop build of the app, either Linux or macOS. (See the "Desktop support" section in the README.)

@yash-agarwa-l
Copy link
Contributor Author

Thanks, I tested this on a desktop build to check the behavior on wider screens. The dropdown still expands to consume the full width of the view, so there is no visible difference there either.

before after

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)
@gnprice
Copy link
Member

gnprice commented Feb 5, 2026

OK. Thanks for the thorough testing!

I believe this change would be the right version if we do in the future have the autocomplete popup be sometimes narrower than the input. So I'll go ahead and merge, with an added note in the commit message:

     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:
     https://github.com/zulip/zulip-flutter/pull/1991#issuecomment-3726847283

@gnprice gnprice merged commit b2a1cd9 into zulip:main Feb 5, 2026
1 check passed
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.

3 participants