mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
Set focus to search when opening add integration dialog (#4357)
* Set focus to search when opening add integration dialog * Also add to flow form
This commit is contained in:
parent
2c57ab60f1
commit
609763e658
@ -16,6 +16,10 @@ import "@material/mwc-button";
|
|||||||
class SearchInput extends LitElement {
|
class SearchInput extends LitElement {
|
||||||
@property() private filter?: string;
|
@property() private filter?: string;
|
||||||
|
|
||||||
|
public focus() {
|
||||||
|
this.shadowRoot!.querySelector("paper-input")!.focus();
|
||||||
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult | void {
|
protected render(): TemplateResult | void {
|
||||||
return html`
|
return html`
|
||||||
<div class="search-container">
|
<div class="search-container">
|
||||||
|
@ -109,6 +109,7 @@ class StepFlowForm extends LitElement {
|
|||||||
|
|
||||||
protected firstUpdated(changedProps: PropertyValues) {
|
protected firstUpdated(changedProps: PropertyValues) {
|
||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
|
setTimeout(() => this.shadowRoot!.querySelector("ha-form")!.focus(), 0);
|
||||||
this.addEventListener("keypress", (ev) => {
|
this.addEventListener("keypress", (ev) => {
|
||||||
if (ev.keyCode === 13) {
|
if (ev.keyCode === 13) {
|
||||||
this._submitStep();
|
this._submitStep();
|
||||||
|
@ -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) {
|
protected updated(changedProps) {
|
||||||
super.updated(changedProps);
|
super.updated(changedProps);
|
||||||
// Store the width so that when we search, box doesn't jump
|
// Store the width so that when we search, box doesn't jump
|
||||||
|
Loading…
x
Reference in New Issue
Block a user