Skip to content

Calling reset on a autocomplete FormControl sometimes does not close the autocomplete dropdown. #8496

@neonguru

Description

@neonguru

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Calling reset on the FormControl of an autocomplete UI should close the autocomplete dropdown.

What is the current behavior?

When calling reset on the FormControl of an autocomplete UI, inside the (optionSelected) handler when using a dialog to get the exact value, the autocomplete dropdown does not close.

What are the steps to reproduce?

I have created a plunker that exhibits the bug: plunker
The autocomplete control has the following options:

options = [
{name:'One', value: 10},
{name:'Two', value: 20},
{name:'Two', value: 21},
{name:'Two', value: 22},
{name:'Three', value: 30}
];

The filter only shows the name of the option, and if there are duplicates, it only shows one of them. Then if they select one of the duplicates, it brings up a dialog to refine the selection.

If the user selects options One or Three, the reset works as expected. But if the user selects Two and then one of the options in the dialog, then the reset call does not close the dropdown. Even calling blur on the input control does not fully reset it.

What is the use-case or motivation for changing an existing behavior?

I want the user to be able to select on option and not be left with a large autocomplete dropdown blocking much of the page.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

@angular 5.0.1
@angular/material 5.0.0-rc0
Chrome on windows and Android
FireFox
IE and Edge do not have this problem
Safari unknown

Is there anything else we should know?

I am open to using a workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions