Fix pickers not getting focus (#14068)

* fix focus pickers

* await nextRender instead of setTimeout

* use bram's code

* Update src/components/ha-target-picker.ts

Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>

Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
This commit is contained in:
Travis Collins
2022-10-17 03:01:17 -06:00
committed by GitHub
parent dad7c43fd2
commit 0972cb4583
5 changed files with 33 additions and 41 deletions

View File

@@ -251,10 +251,8 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
private async _showPicker(ev) {
this._addMode = ev.currentTarget.type;
await this.updateComplete;
setTimeout(() => {
this._inputElement?.open();
this._inputElement?.focus();
}, 0);
await this._inputElement?.focus();
await this._inputElement?.open();
}
private _renderChip(