Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/common/search/search-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import "@material/mwc-button";
class SearchInput extends LitElement {
@property() private filter?: string;

public focus() {
this.shadowRoot!.querySelector("paper-input")!.focus();
}

protected render(): TemplateResult | void {
return html`
<div class="search-container">
Expand Down
1 change: 1 addition & 0 deletions src/dialogs/config-flow/step-flow-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class StepFlowForm extends LitElement {

protected firstUpdated(changedProps: PropertyValues) {
super.firstUpdated(changedProps);
setTimeout(() => this.shadowRoot!.querySelector("ha-form")!.focus(), 0);
this.addEventListener("keypress", (ev) => {
if (ev.keyCode === 13) {
this._submitStep();
Expand Down
8 changes: 8 additions & 0 deletions src/dialogs/config-flow/step-flow-pick-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ class StepFlowPickHandler extends LitElement {
`;
}

protected firstUpdated(changedProps) {
super.firstUpdated(changedProps);
setTimeout(
() => this.shadowRoot!.querySelector("search-input")!.focus(),
0
);
}

protected updated(changedProps) {
super.updated(changedProps);
// Store the width so that when we search, box doesn't jump
Expand Down