Fix scrolling items in the bottom into view (#26830)

This commit is contained in:
Bram Kragten
2025-09-02 14:57:11 +02:00
committed by GitHub
parent b70d309297
commit 9d55843629
9 changed files with 31 additions and 16 deletions

View File

@@ -739,12 +739,12 @@ export default class HaAutomationActionRow extends LitElement {
this._collapsed = false;
if (this.narrow) {
requestAnimationFrame(() => {
window.setTimeout(() => {
this.scrollIntoView({
block: "start",
behavior: "smooth",
});
});
}, 180); // duration of transition of added padding for bottom sheet
}
}

View File

@@ -710,12 +710,12 @@ export default class HaAutomationConditionRow extends LitElement {
this._collapsed = false;
if (this.narrow) {
requestAnimationFrame(() => {
window.setTimeout(() => {
this.scrollIntoView({
block: "start",
behavior: "smooth",
});
});
}, 180); // duration of transition of added padding for bottom sheet
}
}

View File

@@ -274,7 +274,11 @@ export class HaManualAutomationEditor extends LitElement {
})}
>
<div class="content-wrapper">
<div class="content">
<div
class="content ${this._sidebarConfig && this.narrow
? "has-bottom-sheet"
: ""}"
>
<slot name="alerts"></slot>
${this._renderContent()}
</div>

View File

@@ -408,12 +408,12 @@ export default class HaAutomationOptionRow extends LitElement {
this._collapsed = false;
if (this.narrow) {
requestAnimationFrame(() => {
window.setTimeout(() => {
this.scrollIntoView({
block: "start",
behavior: "smooth",
});
});
}, 180); // duration of transition of added padding for bottom sheet
}
}

View File

@@ -136,6 +136,11 @@ export const manualEditorStyles = css`
.content {
padding-top: 24px;
padding-bottom: 72px;
transition: padding-bottom 180ms ease-in-out;
}
.content.has-bottom-sheet {
padding-bottom: calc(90vh - 72px);
}
ha-automation-sidebar {

View File

@@ -520,12 +520,12 @@ export default class HaAutomationTriggerRow extends LitElement {
this._selected = true;
if (this.narrow) {
requestAnimationFrame(() => {
window.setTimeout(() => {
this.scrollIntoView({
block: "start",
behavior: "smooth",
});
});
}, 180);
}
}

View File

@@ -236,12 +236,12 @@ export default class HaScriptFieldRow extends LitElement {
} satisfies ScriptFieldSidebarConfig);
if (this.narrow) {
requestAnimationFrame(() => {
window.setTimeout(() => {
this.scrollIntoView({
block: "start",
behavior: "smooth",
});
});
}, 180); // duration of transition of added padding for bottom sheet
}
}

View File

@@ -76,10 +76,12 @@ export default class HaScriptFields extends LitElement {
row.focus();
if (this.narrow) {
window.setTimeout(() => {
row.scrollIntoView({
block: "start",
behavior: "smooth",
});
}, 180); // duration of transition of added padding for bottom sheet
}
});
}

View File

@@ -218,7 +218,11 @@ export class HaManualScriptEditor extends LitElement {
})}
>
<div class="content-wrapper">
<div class="content">
<div
class="content ${this._sidebarConfig && this.narrow
? "has-bottom-sheet"
: ""}"
>
<slot name="alerts"></slot>
${this._renderContent()}
</div>