-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(autocomplete): properly show dropdown on focus when minlength is met #9291
fix(autocomplete): properly show dropdown on focus when minlength is met #9291
Conversation
function isSearchable() { | ||
if (ctrl.loading && !hasMatches()) return false; // No query when query is in progress. | ||
else if (hasSelection()) return false; // No query if there is already a selection | ||
else if (!hasFocus) return false; // No query if the input does not have focus |
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.
Quick note: I don't think the else if
is necessary here since you're doing a return. I'm really not sure why I had that in my shouldHide()
code...
Code-wise it looks pretty good. I'll need to do some manual testing to make sure it works as expected. |
…met. Currently the `md-autocomplete` shows its dropdown only by changing the `searchText` from `null` to an empty string. > This triggered a searchText change, which resulted in triggering a query. This approach doesn't seem to be very elegant. > The autocomplete should manually trigger a query and possibly open the dropdown if matches are available. Fixes angular#9283. Closes angular#9288. Closes angular#9289.
ac49151
to
fc4fc91
Compare
@ThomasBurleson LGTM 👍 |
// Wait for the input to move horizontally, because the chip was removed. | ||
// This can lead to an incorrect dropdown position. | ||
this.autocompleteCtrl.hidden = true; | ||
this.$mdUtil.nextTick(this.onFocus.bind(this)); |
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.
@devversion I updated to 1.1.1 and this breaks, because this.$mdUtil is undefined. It is never assigned in the constructor.
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.
Known issue - see #9528
…met. (angular#9291) Currently the `md-autocomplete` shows its dropdown only by changing the `searchText` from `null` to an empty string. > This triggered a searchText change, which resulted in triggering a query. This approach doesn't seem to be very elegant. > The autocomplete should manually trigger a query and possibly open the dropdown if matches are available. Fixes angular#9283. Closes angular#9288. Closes angular#9289.
Currently the
md-autocomplete
shows its dropdown only by changing thesearchText
fromnull
to an empty string.This approach doesn't seem to be very elegant.
@topherfangio Can you take a look (especially on the chips with autocomplete behavior)
@ThomasBurleson I consider this as too risky for 1.1.0 (specifically the behavior with the chips)
Fixes #9283. Closes #9288. Closes #9289.