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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 = [

View File

@ -421,7 +421,7 @@ export class MoreInfoDialog extends LitElement {
outline: none;
}
.heading {
ha-dialog[scrolled] .heading {
border-bottom: 1px solid
var(--mdc-dialog-scroll-divider-color, rgba(0, 0, 0, 0.12));
}