Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

apoorvapendse
Copy link

@apoorvapendse apoorvapendse commented Dec 11, 2024

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

image
image

@apoorvapendse apoorvapendse force-pushed the put-best-matches-near-fingers branch 3 times, most recently from a146a49 to bd3a205 Compare December 16, 2024 02:00
Copy link
Member

@PIG208 PIG208 left a 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.

test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
await tester.enterText(composeInputFinder, 'hello @A');
await tester.pumpAndSettle();
//only first seven users render initially, 8th user has to be accessed by scrolling up
for(int i = 0 ;i < 7 ;i++){
Copy link
Member

Choose a reason for hiding this comment

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

nit: consistent spacing (and at other places)

for (int i = 0; i < 7; i++) {

Copy link
Author

@apoorvapendse apoorvapendse Dec 18, 2024

Choose a reason for hiding this comment

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

okay, I've updated so that no matches are found for //[a-z][A-Z]

Copy link
Member

Choose a reason for hiding this comment

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

bump. Looks like this still needs to be fixed:

Suggested change
for(int i = 0 ;i < 7 ;i++){
for (int i = 0; i < 7; i++) {

test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
test/widgets/autocomplete_test.dart Show resolved Hide resolved
test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
@apoorvapendse apoorvapendse force-pushed the put-best-matches-near-fingers branch from bd3a205 to 129434b Compare December 18, 2024 03:04
@apoorvapendse
Copy link
Author

Hey @PIG208, thanks for reviewing the PR.
I've updated it and hope it meets your expectations.
Could you please elaborate on what kind of comment is expected as per this comment
Thanks.

@apoorvapendse apoorvapendse requested a review from PIG208 December 18, 2024 03:16
@apoorvapendse apoorvapendse force-pushed the put-best-matches-near-fingers branch from 129434b to b35ddbf Compare December 18, 2024 03:18
@PIG208 PIG208 self-assigned this Dec 18, 2024
@PIG208 PIG208 added the maintainer review PR ready for review by Zulip maintainers label Dec 18, 2024
@apoorvapendse
Copy link
Author

@PIG208 thank you for clarifying ,
I don't think this is affected by #226, since the default behavior on CZO also requires you to enter :<some text> in order to trigger the emoji typehead.

Open to your feedback.
Thank you.

@apoorvapendse apoorvapendse requested a review from PIG208 December 19, 2024 02:17
@apoorvapendse apoorvapendse force-pushed the put-best-matches-near-fingers branch from b35ddbf to df05da4 Compare December 19, 2024 17:28
@apoorvapendse
Copy link
Author

Hey @PIG208,
I am sorry, did you mean to mention #226 instead of #227 in this comment.

I added a comment mentioning that dependency here in the latest commit.

Is that what was expected?

@apoorvapendse apoorvapendse force-pushed the put-best-matches-near-fingers branch from df05da4 to 5ae02ae Compare December 19, 2024 17:33
Copy link
Member

@PIG208 PIG208 left a 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.

test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
await tester.enterText(composeInputFinder, 'hello @A');
await tester.pumpAndSettle();
//only first seven users render initially, 8th user has to be accessed by scrolling up
for(int i = 0 ;i < 7 ;i++){
Copy link
Member

Choose a reason for hiding this comment

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

bump. Looks like this still needs to be fixed:

Suggested change
for(int i = 0 ;i < 7 ;i++){
for (int i = 0; i < 7; i++) {

test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
@apoorvapendse apoorvapendse force-pushed the put-best-matches-near-fingers branch 3 times, most recently from 95f971d to 2f522f5 Compare December 20, 2024 02:06
@apoorvapendse
Copy link
Author

apoorvapendse commented Dec 20, 2024

Change Summary for @PIG208

  • Replaced pumpAndSettle with pump
  • Addressed your concern regarding the removal of scrolling in the opposite direction.
  • Addressed your concern regarding the usefullness of scrolling.
    Replaced comparing listViewFinder.dy with comparing the y position of the first emoji & mention in case of negative y offset.
    See CZO topic I created for more details.
  • Removed ListViewFinder render checks as suggested.
  • Moved ListViewFinder initialization before initialScrollOffset as suggested.
  • Wrapped the end parens as mentioned.
  • Broke the check statements into multiple lines as per this input.
  • Removed the redundant check(because:'Each user option should be rendered (index: $i)',finder).findsOne(); as suggested.
  • Addressed other long line check statements.
  • Removed expectedUserSequence and used users instead.
  • Fixed other spacing issues.

Thank you for being patient.
I believe this PR is ready for another review.

@apoorvapendse apoorvapendse force-pushed the put-best-matches-near-fingers branch 4 times, most recently from e2bd10c to cd4226e Compare December 20, 2024 03:24
@PIG208 PIG208 self-requested a review December 23, 2024 17:23
@apoorvapendse apoorvapendse force-pushed the put-best-matches-near-fingers branch from cd4226e to 1b8cf39 Compare December 24, 2024 02:01
@apoorvapendse
Copy link
Author

apoorvapendse commented Dec 24, 2024

Sorry for responding so late @PIG208 .
GitHub didn't send me any emails about your replies.

I've fixed the for loop formatting here, here and here.

Copy link
Member

@PIG208 PIG208 left a 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.

test/widgets/autocomplete_test.dart Outdated Show resolved Hide resolved
@apoorvapendse apoorvapendse force-pushed the put-best-matches-near-fingers branch from 1b8cf39 to 4b9245b Compare December 27, 2024 01:54
@apoorvapendse
Copy link
Author

apoorvapendse commented Dec 27, 2024

Hi @PIG208,
Thank you for your review and example rewrite.
I've added the test you gave as it is, and added you as the Co-author.

Change Summary:

  1. Made the @-mention test short similar to your example.
  2. I also wanted to get your opinion on whether this check is redundant.
    It feels redundant to me since we are already checking if the last option is rendered.

Happy to get feedback on this.
Thanks.

@apoorvapendse apoorvapendse force-pushed the put-best-matches-near-fingers branch 2 times, most recently from 3a19206 to dc1a5eb Compare December 27, 2024 02:06
@apoorvapendse apoorvapendse requested a review from PIG208 December 27, 2024 02:07
@apoorvapendse apoorvapendse force-pushed the put-best-matches-near-fingers branch from dc1a5eb to c1ac550 Compare December 27, 2024 02:08
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 zulip#226 where
required.

Co-authored-by: Zixuan James Li <[email protected]>
Fixes zulip#1121.
@apoorvapendse apoorvapendse force-pushed the put-best-matches-near-fingers branch from c1ac550 to 08f9b96 Compare December 27, 2024 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintainer review PR ready for review by Zulip maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Put best autocomplete matches at bottom of list, not top
2 participants