mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Drawer fix (#19789)
This commit is contained in:
parent
c5a3670838
commit
b65dc47f72
@ -3,7 +3,6 @@ import { styles } from "@material/mwc-drawer/mwc-drawer.css";
|
|||||||
import { css, PropertyValues } from "lit";
|
import { css, PropertyValues } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { fireEvent } from "../common/dom/fire_event";
|
import { fireEvent } from "../common/dom/fire_event";
|
||||||
import { mainWindow } from "../common/dom/get_main_window";
|
|
||||||
|
|
||||||
const blockingElements = (document as any).$blockingElements;
|
const blockingElements = (document as any).$blockingElements;
|
||||||
|
|
||||||
@ -34,7 +33,8 @@ export class HaDrawer extends DrawerBase {
|
|||||||
protected updated(changedProps: PropertyValues) {
|
protected updated(changedProps: PropertyValues) {
|
||||||
super.updated(changedProps);
|
super.updated(changedProps);
|
||||||
if (changedProps.has("direction")) {
|
if (changedProps.has("direction")) {
|
||||||
if (mainWindow.document.dir === "rtl") {
|
this.mdcRoot.dir = this.direction;
|
||||||
|
if (this.direction === "rtl") {
|
||||||
this._rtlStyle = document.createElement("style");
|
this._rtlStyle = document.createElement("style");
|
||||||
this._rtlStyle.innerHTML = `
|
this._rtlStyle.innerHTML = `
|
||||||
.mdc-drawer--animate {
|
.mdc-drawer--animate {
|
||||||
|
@ -14,6 +14,7 @@ import "./notification-item";
|
|||||||
import "../../components/ha-header-bar";
|
import "../../components/ha-header-bar";
|
||||||
import "../../components/ha-drawer";
|
import "../../components/ha-drawer";
|
||||||
import type { HaDrawer } from "../../components/ha-drawer";
|
import type { HaDrawer } from "../../components/ha-drawer";
|
||||||
|
import { computeRTLDirection } from "../../common/util/compute_rtl";
|
||||||
|
|
||||||
@customElement("notification-drawer")
|
@customElement("notification-drawer")
|
||||||
export class HuiNotificationDrawer extends LitElement {
|
export class HuiNotificationDrawer extends LitElement {
|
||||||
@ -92,7 +93,12 @@ export class HuiNotificationDrawer extends LitElement {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-drawer type="modal" open @MDCDrawer:closed=${this._dialogClosed}>
|
<ha-drawer
|
||||||
|
type="modal"
|
||||||
|
open
|
||||||
|
@MDCDrawer:closed=${this._dialogClosed}
|
||||||
|
.direction=${computeRTLDirection(this.hass)}
|
||||||
|
>
|
||||||
<ha-header-bar>
|
<ha-header-bar>
|
||||||
<div slot="title">
|
<div slot="title">
|
||||||
${this.hass.localize("ui.notification_drawer.title")}
|
${this.hass.localize("ui.notification_drawer.title")}
|
||||||
|
@ -15,6 +15,7 @@ import "../components/ha-drawer";
|
|||||||
import { showNotificationDrawer } from "../dialogs/notifications/show-notification-drawer";
|
import { showNotificationDrawer } from "../dialogs/notifications/show-notification-drawer";
|
||||||
import type { HomeAssistant, Route } from "../types";
|
import type { HomeAssistant, Route } from "../types";
|
||||||
import "./partial-panel-resolver";
|
import "./partial-panel-resolver";
|
||||||
|
import { computeRTLDirection } from "../common/util/compute_rtl";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
// for fire event
|
// for fire event
|
||||||
@ -61,6 +62,7 @@ export class HomeAssistantMain extends LitElement {
|
|||||||
<ha-drawer
|
<ha-drawer
|
||||||
.type=${sidebarNarrow ? "modal" : ""}
|
.type=${sidebarNarrow ? "modal" : ""}
|
||||||
.open=${sidebarNarrow ? this._drawerOpen : undefined}
|
.open=${sidebarNarrow ? this._drawerOpen : undefined}
|
||||||
|
.direction=${computeRTLDirection(this.hass)}
|
||||||
@MDCDrawer:closed=${this._drawerClosed}
|
@MDCDrawer:closed=${this._drawerClosed}
|
||||||
>
|
>
|
||||||
<ha-sidebar
|
<ha-sidebar
|
||||||
|
Loading…
x
Reference in New Issue
Block a user