Skip to content

Commit

Permalink
Fix for RTL in Supervisor dashboards (home-assistant#19290)
Browse files Browse the repository at this point in the history
  • Loading branch information
yosilevy authored Jan 5, 2024
1 parent 7a8f5c0 commit 783a824
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions hassio/src/dashboard/hassio-addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class HassioAddons extends LitElement {
ha-card {
cursor: pointer;
overflow: hidden;
direction: ltr;
}
.search {
position: sticky;
Expand Down
2 changes: 2 additions & 0 deletions hassio/src/dashboard/hassio-dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ class HassioDashboard extends LitElement {
position: fixed;
right: calc(16px + env(safe-area-inset-right));
bottom: calc(16px + env(safe-area-inset-bottom));
inset-inline-end: calc(16px + env(safe-area-inset-right));
inset-inline-start: initial;
z-index: 1;
}
`,
Expand Down
10 changes: 10 additions & 0 deletions hassio/src/supervisor-base-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ import { ProvideHassLitMixin } from "../../src/mixins/provide-hass-lit-mixin";
import { urlSyncMixin } from "../../src/state/url-sync-mixin";
import { HomeAssistant, Route } from "../../src/types";
import { getTranslation } from "../../src/util/common-translation";
import {
computeRTLDirection,
setDirectionStyles,
} from "../../src/common/util/compute_rtl";

declare global {
interface HASSDomEvents {
Expand Down Expand Up @@ -95,6 +99,7 @@ export class SupervisorBaseElement extends urlSyncMixin(

if (changedProperties.has("_language") || !this.hasUpdated) {
this._initializeLocalize();
this._applyDirection(this.hass);
}
}

Expand Down Expand Up @@ -215,4 +220,9 @@ export class SupervisorBaseElement extends urlSyncMixin(
);
}
}

private _applyDirection(hass: HomeAssistant) {
const direction = computeRTLDirection(hass);
setDirectionStyles(direction, this);
}
}

0 comments on commit 783a824

Please sign in to comment.