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

fix(autocomplete): don't show the menu panel when readonly #11245

Merged
merged 1 commit into from
Apr 21, 2018

Conversation

Splaktar
Copy link
Contributor

PR Checklist

Please check that your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

Autocomplete menu opens and shows options when readonly is set to true. This could sometimes happen when no value was selected.

Issue Number:
Fixes #11231

What is the new behavior?

The menu is never shown when readonly is set to true.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

N/A

@Splaktar Splaktar added type: bug a11y This issue is related to accessibility P3: important Important issues that really should be fixed when possible. labels Apr 19, 2018
@Splaktar Splaktar added this to the 1.1.9 milestone Apr 19, 2018
@googlebot googlebot added the cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ label Apr 19, 2018
@Splaktar Splaktar added the pr: merge ready This PR is ready for a caretaker to review label Apr 19, 2018
*/
function shouldHide () {
if (!isSearchable()) return true; // Hide when not able to query
else return !shouldShow(); // Hide when the dropdown is not able to show.
// Hide when not able to run the query.
Copy link
Contributor

Choose a reason for hiding this comment

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

The fact that this isn't just return !this.shouldShow() feels kind of weird to me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. I've made an update. What do you think?

this could sometimes happen when no value was selected

Fixes #11231
@Splaktar Splaktar force-pushed the autocompleteRespectReadonly branch from 2d99541 to 7a1d26e Compare April 19, 2018 19:43
@mmalerba mmalerba merged commit 0fe831a into master Apr 21, 2018
@Splaktar Splaktar deleted the autocompleteRespectReadonly branch April 21, 2018 18:04
chmelevskij pushed a commit to chmelevskij/material that referenced this pull request Jun 19, 2018
…1245)

this could sometimes happen when no value was selected

Fixes angular#11231
Splaktar added a commit that referenced this pull request Jul 31, 2018
this could sometimes happen when no value was selected

Fixes #11231
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a11y This issue is related to accessibility cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ P3: important Important issues that really should be fixed when possible. pr: merge ready This PR is ready for a caretaker to review type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

autocomplete: ng-readonly w/ empty value still responds to clicks/focus and opens menu
3 participants