mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 00:06:35 +00:00
Remove inert property on combobox overlay when items change (#13928)
This commit is contained in:
parent
0ec887ad50
commit
cd8c1f42ca
@ -8,7 +8,14 @@ import type {
|
||||
ComboBoxLightValueChangedEvent,
|
||||
} from "@vaadin/combo-box/vaadin-combo-box-light";
|
||||
import { registerStyles } from "@vaadin/vaadin-themable-mixin/register-styles";
|
||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
||||
import {
|
||||
css,
|
||||
CSSResultGroup,
|
||||
html,
|
||||
LitElement,
|
||||
PropertyValues,
|
||||
TemplateResult,
|
||||
} from "lit";
|
||||
import { ComboBoxLitRenderer, comboBoxRenderer } from "@vaadin/combo-box/lit";
|
||||
import { customElement, property, query } from "lit/decorators";
|
||||
import { ifDefined } from "lit/directives/if-defined";
|
||||
@ -225,11 +232,13 @@ export class HaComboBox extends LitElement {
|
||||
// @ts-ignore
|
||||
fireEvent(this, ev.type, ev.detail);
|
||||
|
||||
if (
|
||||
opened &&
|
||||
"MutationObserver" in window &&
|
||||
!this._overlayMutationObserver
|
||||
) {
|
||||
if (opened) {
|
||||
this.removeInertOnOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
private removeInertOnOverlay() {
|
||||
if ("MutationObserver" in window && !this._overlayMutationObserver) {
|
||||
const overlay = document.querySelector<HTMLElement>(
|
||||
"vaadin-combo-box-overlay"
|
||||
);
|
||||
@ -268,6 +277,16 @@ export class HaComboBox extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
updated(changedProps: PropertyValues) {
|
||||
super.updated(changedProps);
|
||||
if (
|
||||
changedProps.has("filteredItems") ||
|
||||
(changedProps.has("items") && this.opened)
|
||||
) {
|
||||
this.removeInertOnOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
private _filterChanged(ev: ComboBoxLightFilterChangedEvent) {
|
||||
// @ts-ignore
|
||||
fireEvent(this, ev.type, ev.detail, { composed: false });
|
||||
|
@ -13,7 +13,7 @@ type IconItem = {
|
||||
icon: string;
|
||||
keywords: string[];
|
||||
};
|
||||
let iconItems: IconItem[] = [{ icon: "", keywords: [] }];
|
||||
let iconItems: IconItem[] = [];
|
||||
let iconLoaded = false;
|
||||
|
||||
// eslint-disable-next-line lit/prefer-static-styles
|
||||
|
@ -20,7 +20,7 @@ type NavigationItem = {
|
||||
title: string;
|
||||
};
|
||||
|
||||
const DEFAULT_ITEMS: NavigationItem[] = [{ path: "", icon: "", title: "" }];
|
||||
const DEFAULT_ITEMS: NavigationItem[] = [];
|
||||
|
||||
// eslint-disable-next-line lit/prefer-static-styles
|
||||
const rowRenderer: ComboBoxLitRenderer<NavigationItem> = (item) => html`
|
||||
|
Loading…
x
Reference in New Issue
Block a user