Only show heading divider on more info dialog scroll (#15545)

This commit is contained in:
Paul Bottein
2023-02-22 17:17:39 +01:00
committed by GitHub
parent 3158e6043d
commit e697a09e53
2 changed files with 16 additions and 1 deletions

View File

@@ -40,6 +40,21 @@ export class HaDialog extends DialogBase {
this.suppressDefaultPressSelector,
SUPPRESS_DEFAULT_PRESS_SELECTOR,
].join(", ");
this._updateScrolledAttribute();
this.contentElement?.addEventListener("scroll", this._onScroll);
}
disconnectedCallback(): void {
this.contentElement.removeEventListener("scroll", this._onScroll);
}
private _onScroll = () => {
this._updateScrolledAttribute();
};
private _updateScrolledAttribute() {
if (!this.contentElement) return;
this.toggleAttribute("scrolled", this.contentElement.scrollTop !== 0);
}
static override styles = [