Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

fix(autocomplete): properly show dropdown on focus when minlength is met #9291

Merged
merged 1 commit into from
Sep 1, 2016

Conversation

devversion
Copy link
Member

@devversion devversion commented Aug 11, 2016

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.

@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.

@devversion devversion added the needs: review This PR is waiting on review from the team label Aug 11, 2016
@devversion devversion added this to the 1.1.1 milestone Aug 11, 2016
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
Copy link
Contributor

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...

@topherfangio
Copy link
Contributor

Code-wise it looks pretty good. I'll need to do some manual testing to make sure it works as expected.

@topherfangio topherfangio added the needs: manual testing This issue or PR needs to have some manual testing and verification done label Aug 11, 2016
…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.
@devversion devversion force-pushed the fix/autocomplete-focus-min-length branch from ac49151 to fc4fc91 Compare August 26, 2016 13:23
@topherfangio
Copy link
Contributor

@ThomasBurleson LGTM 👍

@topherfangio topherfangio removed the needs: manual testing This issue or PR needs to have some manual testing and verification done label Aug 26, 2016
@topherfangio topherfangio removed their assignment Aug 26, 2016
@devversion devversion modified the milestones: 1.1.2, 1.1.1 Aug 29, 2016
@ThomasBurleson ThomasBurleson added pr: merge ready This PR is ready for a caretaker to review and removed needs: review This PR is waiting on review from the team labels Aug 31, 2016
@ThomasBurleson ThomasBurleson modified the milestones: 1.1.1, 1.1.2 Aug 31, 2016
@hansl hansl merged commit e65ffc8 into angular:master Sep 1, 2016
@devversion devversion deleted the fix/autocomplete-focus-min-length branch September 1, 2016 18:58
// 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));
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Known issue - see #9528

Frank3K pushed a commit to Frank3K/material that referenced this pull request Sep 11, 2016
…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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr: merge ready This PR is ready for a caretaker to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants