From eaaeb10c6d7b99998d503899b40b6b7887020d50 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 16 Jul 2019 21:34:12 -0700 Subject: [PATCH] Store width before searching to avoid jumping --- .../config-flow/step-flow-pick-handler.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/dialogs/config-flow/step-flow-pick-handler.ts b/src/dialogs/config-flow/step-flow-pick-handler.ts index 0fbe0ba597..8599155837 100644 --- a/src/dialogs/config-flow/step-flow-pick-handler.ts +++ b/src/dialogs/config-flow/step-flow-pick-handler.ts @@ -18,6 +18,7 @@ import * as Fuse from "fuse.js"; import "../../components/ha-icon-next"; import "../../common/search/search-input"; +import { styleMap } from "lit-html/directives/style-map"; interface HandlerObj { name: string; @@ -29,6 +30,7 @@ class StepFlowPickHandler extends LitElement { @property() public hass!: HomeAssistant; @property() public handlers!: string[]; @property() private filter?: string; + private _width?: Number; private _getHandlers = memoizeOne((h: string[], filter?: string) => { const handlers: HandlerObj[] = h.map((handler) => { @@ -58,11 +60,11 @@ class StepFlowPickHandler extends LitElement { return html`

${this.hass.localize("ui.panel.config.integrations.new")}

-
- + +
${handlers.map( (handler: HandlerObj) => html` @@ -80,6 +82,11 @@ class StepFlowPickHandler extends LitElement { private async _filterChanged(e) { this.filter = e.detail.value; + + // Store the width so that when we search, box doesn't jump + if (this._width === undefined) { + this._width = this.shadowRoot!.querySelector("div")!.clientWidth; + } } private async _handlerPicked(ev) {