Random fixes (#3328)

* Fix scroll into view on first load

* Do not crash when deleting script/automation

* Disable swipe on notification drawer
This commit is contained in:
Paulus Schoutsen 2019-07-02 10:31:48 -07:00 committed by GitHub
parent deaccd6cd4
commit 6f77992387
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 12 deletions

View File

@ -306,10 +306,11 @@ class HaSidebar extends LitElement {
}
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
if (!oldHass || oldHass.panelUrl !== this.hass.panelUrl) {
this.shadowRoot!.querySelector(
".iron-selected"
const selectedEl = this.shadowRoot!.querySelector(".iron-selected");
if (selectedEl) {
// @ts-ignore
)!.scrollIntoViewIfNeeded();
selectedEl.scrollIntoViewIfNeeded();
}
}
}

View File

@ -45,7 +45,7 @@ export class HuiNotificationDrawer extends EventsMixin(
text-align: center;
}
</style>
<app-drawer id='drawer' opened="{{open}}">
<app-drawer id='drawer' opened="{{open}}" disable-swipe>
<app-toolbar>
<div main-title>[[localize('ui.notification_drawer.title')]]</div>
<ha-paper-icon-button-prev on-click="_closeDrawer"></paper-icon-button>

View File

@ -26,7 +26,6 @@ import { HomeAssistant } from "../../../types";
import { AutomationEntity } from "../../../data/automation";
import format_date_time from "../../../common/datetime/format_date_time";
import { fireEvent } from "../../../common/dom/fire_event";
import { repeat } from "lit-html/directives/repeat";
@customElement("ha-automation-picker")
class HaAutomationPicker extends LitElement {
@ -74,9 +73,7 @@ class HaAutomationPicker extends LitElement {
</p>
</div>
`
: repeat(
this.automations,
(automation) => automation.entity_id,
: this.automations.map(
(automation) => html`
<div class='automation'>

View File

@ -25,7 +25,6 @@ import { haStyle } from "../../../resources/styles";
import { HomeAssistant } from "../../../types";
import { triggerScript } from "../../../data/script";
import { showToast } from "../../../util/toast";
import { repeat } from "lit-html/directives/repeat";
@customElement("ha-script-picker")
class HaScriptPicker extends LitElement {
@ -57,9 +56,7 @@ class HaScriptPicker extends LitElement {
<p>We couldn't find any scripts.</p>
</div>
`
: repeat(
this.scripts,
(script) => script.entity_id,
: this.scripts.map(
(script) => html`
<div class="script">
<paper-icon-button