components icon indicating copy to clipboard operation
components copied to clipboard

[Autocomplete]: autoActiveFirstOption not working when tabbing in with disabled floatLabel

Open thomaspink opened this issue 8 years ago • 1 comments

Bug, feature request, or proposal:

When tabbing into (not clicking!) an autocomplete with autoActiveFirstOption enabled and floatLabel disabled on the form field, the first option does not become active. It will become active if you press another key after tabbing in, inspecting the element or any other action that cause an event for the zone.

When adding this._changeDetectorRef.detectChanges(); in autocomplete-trigger.ts at line 500, it works (src/lib/autocomplete/autocomplete-trigger.ts:500).

My guess is that at this point the zone is stable and all the changes done (setting the active option, ...) are not picked up for the CD. When enabling floatLabel, it works as expected. So it seems that the floatLabel triggers another CD after that, and the changes will get recognized.

What is the expected behavior?

First option should be active.

What is the current behavior?

First option is not active.

What are the steps to reproduce?

https://stackblitz.com/edit/angular-j6jza7?file=app/autocomplete-auto-active-first-option-example.html

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

Current versions. Forked the existing material autocomplete autoActiveFirstOption stackblitz example.

thomaspink avatar Oct 22 '18 08:10 thomaspink

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.