-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autocomplete: Put best matches near input field. #1131
base: main
Are you sure you want to change the base?
autocomplete: Put best matches near input field. #1131
Conversation
a146a49
to
bd3a205
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @apoorvapendse! Left some comment.
This doesn't fix #1123 because the emoji picker (added in #1103) is a feature separate from autocompletion, so please update the PR comment and the commit message to reflect that.
bd3a205
to
129434b
Compare
129434b
to
b35ddbf
Compare
@PIG208 thank you for clarifying , Open to your feedback. |
b35ddbf
to
df05da4
Compare
Hey @PIG208, I added a comment mentioning that dependency here in the latest commit. Is that what was expected? |
df05da4
to
5ae02ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update! Left some more comments. I read the first test and skimmed the second one. It looks like the current approach of getting scroll offset is not working properly.
For the next revision, please do a round of self-review addressing the style issues mentioned in the comments, and apply it to other places as well.
95f971d
to
2f522f5
Compare
Change Summary for @PIG208
Thank you for being patient. |
e2bd10c
to
cd4226e
Compare
cd4226e
to
1b8cf39
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update! I revised the @-mentions test as an example of what we usually expect for testing. Please read it and try to apply the same approach to the similar test for emojis.
3a19206
to
dc1a5eb
Compare
c1ac550
to
08f9b96
Compare
Hi, @PIG208. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. I think the test for emojis needs to be more concise. Maybe try to follow the other one closer as they are testing the same aspect of autocompletion but in different contexts.
test/widgets/autocomplete_test.dart
Outdated
|
||
final positions = emojiSequence.take(8).map((icon) { | ||
final finder = find.text(icon); | ||
check(because:"Each emoji option should be rendered", finder).findsOne(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the because
for this check. findsOne
should be evident that we expect the option to be rendered.
test/widgets/autocomplete_test.dart
Outdated
await tester.pump(); | ||
final firstEmojiPositionAfterScrollDown = tester.getTopLeft(find.text(emojiSequence[0])).dy; | ||
check( | ||
because:"ListView options should not scroll down further than initial position", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is still the spacing issue — there should be a space here because: "..."
test/widgets/autocomplete_test.dart
Outdated
|
||
check( | ||
because: "The last emoji should not be visible before scrolling up" | ||
,find.text(emojiSequence.last) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually we don't start lines with ,
. Format list of arguments using trailing commas instead.
test/widgets/autocomplete_test.dart
Outdated
final positions = emojiSequence.take(8).map((icon) { | ||
final finder = find.text(icon); | ||
check(because:"Each emoji option should be rendered", finder).findsOne(); | ||
return tester.getTopLeft(finder).dy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only need the position of the first element, so this map
can be simplified, similar to the other test case added.
632c295
to
13c33b2
Compare
Change Summary for @PIG208 Updates
BlockersNo blockers, thanks to your detailed feedback. Review requestI have addressed all the 4 comments made in the recent review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update! Left some more comments.
test/widgets/autocomplete_test.dart
Outdated
await tester.enterText(composeInputFinder, 'hi :z'); | ||
await tester.pump(); | ||
|
||
final firstEmojiInitialPosition = tester.getTopLeft(find.text(emojiSequence[0]),warnIfMissed: true).dy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true
is already the default value, so we can omit warnIfMissed: true
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that you removed the emojiSequence.take(8).map
altogether. We do still need the check for (icon) => find.text(icon).findsOne()
, (and additionally a find.text(emojiSequence.last)).findsNothing()
, moving the check from line 320 to here should work).
Having all these check help the reader understand that only the first few options are initially visible, so it makes sense to check again later after scrolling the list. See the other test for reference, as they are quite similar.
test/widgets/autocomplete_test.dart
Outdated
await tester.pump(); | ||
|
||
check(because: "The biohazard emoji should be visible after scrolling up", | ||
find.text(emojiSequence.last)).findsOne(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: indentation
This find
is a part of the check
and should be indented.
test/widgets/autocomplete_test.dart
Outdated
|
||
final firstEmojiPositionAfterScrollUp = tester.getTopLeft(find.text(emojiSequence[0])).dy; | ||
check(because: "Scrolling up should reveal other emoji matches", | ||
firstEmojiPositionAfterScrollUp).isGreaterOrEqual(firstEmojiInitialPosition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: similar indentation issue here too
test/widgets/autocomplete_test.dart
Outdated
firstEmojiPositionAfterScrollUp).isGreaterOrEqual(firstEmojiInitialPosition); | ||
|
||
debugNetworkImageHttpClientProvider = null; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove extra newline
13c33b2
to
35f9a10
Compare
I've done the changes mentioned @PIG208. Thank you for being patient. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit message nit:
Tests have been added to verify the
emoji and mention render behavior.
Normally we include tests whenever there is behavior change, so we can remove this paragraph.
Co-authored-by: Zixuan James Li <[email protected]>
Fixes: https://github.com/zulip/zulip-flutter/issues/1121
should be:
Co-authored-by: Zixuan James Li <[email protected]>
Fixes: #1121
The lines started with Something:
are conventionally placed at the end as an agreed upon metadata structure for commits; there is no strict rules on what types of metadata you can have, but usually they are in this form.
Left some comments, mostly nits.
test/widgets/autocomplete_test.dart
Outdated
final firstEmojiInitialPosition = tester.getTopLeft(find.text(emojiSequence[0])).dy; | ||
final listViewFinder = find.byType(ListView); | ||
|
||
emojiSequence.take(8).forEach((icon)=>check(because:"Each emoji option should be rendered", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just remove the because:
part as it is evident from the code what the check is for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: formatting: (icon) => check(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we rename emojiSequence
to emojiNames
, we can rename icon
to emojiName
.
test/widgets/autocomplete_test.dart
Outdated
find.text(emojiSequence.last) | ||
).findsNothing(); | ||
|
||
// Scroll up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this comment does not seem quite useful, as it just repeats the code below it
I am unable to understand how you see the resolved link here. This is the commit message I see on commit 64f4b77bf4812f97294ba10076a2cf36c6886ef7 (HEAD -> put-best-matches-near-fingers)
Author: Apoorva Pendse <[email protected]>
Date: Wed Dec 11 19:35:54 2024 +0530
autocomplete: Put best matches near input field.
This commit reverses the list that was originally
presented to the user while showing the typeahead menu.
This makes sense since on mobile its easier to click
on options closer to the input box, i.e.
where your fingers are currently present,
instead of pressing arrow keys on a keyboard which is
true on a desktop setup.
Hence we place the best matching options
not at the top of the typeahead menu, but
instead put them at the bottom for better
reachability and convenience of the user.
Tests have been added to verify the
emoji and mention render behavior.
Also mentions dependencies on #226 where
required.
Co-authored-by: Zixuan James Li <[email protected]>
Fixes #1121. |
35f9a10
to
81729e8
Compare
Changelog @PIG208
I think I've addressed all your suggestions and this PR is ready for another review. |
Oh right. That link ( Let's change
to
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All my remaining comments are small. Marking this for Greg's review.
81729e8
to
a7e39fc
Compare
Thanks a lot @PIG208 for your patient reviewing. I've fixed the trailing commas and changed the "biohazard" wording to "last" as advised in the recent round. |
This commit reverses the list that was originally presented to the user while showing the typeahead menu. This makes sense since on mobile its easier to click on options closer to the input box, i.e. where your fingers are currently present, instead of pressing arrow keys on a keyboard which is true on a desktop setup. Hence we place the best matching options not at the top of the typeahead menu, but instead put them at the bottom for better reachability and convenience of the user. Also mentions dependencies on zulip#226 where required. Co-authored-by: Zixuan James Li <[email protected]> Fixes: zulip#1121
a7e39fc
to
ed3d473
Compare
Thanks @apoorvapendse and @PIG208 for all your work on this! There's still an open question here of whether we want to make this change in the UX. That was Alya's feedback on the thread (in #mobile at the time because #mobile-design didn't exist yet; I've just moved it there) last month: Given that state, I think it won't make sense to invest more effort into the implementation before further design discussion. |
This commit reverses the list that was originally
presented to the user while showing the typeahead
menu.
This makes sense since on mobile its easier to click on options closer to the input box, i.e. where your fingers are currently present, instead of pressing arrow keys to navigate through the options on a keyboard which is convenient on a desktop setup.
Hence we place the best matching options not at the top of the typeahead menu, but instead at the bottom for better reachability and convenience of the user.
CZO
Fixes #1121.
Here is a demo:
Screencast from 12-11-2024 12:38:19 PM.webm