-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(autocomplete): reposition the panel when the amount of options changes #4469
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
fix(autocomplete): reposition the panel when the amount of options changes #4469
Conversation
@crisbeto IIRC, we didn't update the position deliberately because it can be disorienting when the panel switches its position while you're typing. Specifically, if you're moving from more options to fewer options as you type (and the panel can now fit in its first preferred position), the panel moves back to its first position mid-word. Example case:
You can see it switch to the bottom midway through typing, even though the options panel would have fit above. I definitely agree that the position should update if the panel starts to extend past the viewport (fewer options -> more options). Any way we can make it so the panel only updates position if the current position doesn't fit? |
We can't right now @kara, but we discussed with Jeremy a while ago that we also shouldn't re-fit the panel in the viewport when you're scrolling. Adding that to the API can be used in this case as well. |
I'm not sure it will @kara. The positioning improvements will change how we manage the overlay's position in general, but I think that we'll still have to recalculate it when the amount of options changes. |
We will probably still need to make changes, but it doesn't seem smart to do so right before major changes to how we handle positioning. Either way, let me know when this PR is again ready for review. |
@crisbeto is this worth revisiting once the new positioning is in? |
Yeah, I think this branch has lived through two iterations of the connected positioning now. |
@crisbeto now that the new positioning strategy is in place. Should we rebase and get this in? |
60fd3be
to
54ab1ab
Compare
Rebased and fixed some issues with the testing setup @josephperrott. |
It looks like the new test failed on travis? |
…anges Fixes the autocomplete panel not being repositioned when the amount of options changes. This is necessary, because adding extra options could push it out of the viewport.
54ab1ab
to
497602d
Compare
It's fixed now @josephperrott. |
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.
LGTM
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes the autocomplete panel not being repositioned when the amount of options changes. This is necessary, because adding extra options could push it out of the viewport.
Note: will look into the iOS test failure. It's most likely an issue with the test setup, rather than the new logic.