Rtl menu fix (#12561)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Yosi Levy
2022-05-11 12:01:45 +03:00
committed by GitHub
parent 5ec7193e5c
commit 7a9c2f56c5
2 changed files with 17 additions and 2 deletions

View File

@@ -50,6 +50,21 @@ export class HaButtonMenu extends LitElement {
`;
}
protected firstUpdated(changedProps): void {
super.firstUpdated(changedProps);
if (document.dir === "rtl") {
this.updateComplete.then(() => {
this.querySelectorAll("mwc-list-item").forEach((item) => {
const style = document.createElement("style");
style.innerHTML =
"span.material-icons:first-of-type { margin-left: var(--mdc-list-item-graphic-margin, 32px) !important; margin-right: 0px !important;}";
item!.shadowRoot!.appendChild(style);
});
});
}
}
private _handleClick(): void {
if (this.disabled) {
return;