From f7f29d1e17f7a84ae1000b920dc0c5b98b20e2b5 Mon Sep 17 00:00:00 2001 From: Yosi Levy Date: Wed, 11 Feb 2026 15:40:21 +0000 Subject: [PATCH 1/3] RTL fixes --- src/components/dialogs/hacs-form-dialog.ts | 7 +++++++ src/components/dialogs/show-hacs-dialog.ts | 7 ++++--- src/dashboards/hacs-dashboard.ts | 1 + src/dashboards/hacs-repository-dashboard.ts | 1 + src/hacs.ts | 21 +++++++++++++++------ 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/components/dialogs/hacs-form-dialog.ts b/src/components/dialogs/hacs-form-dialog.ts index 2cfa6953b..988c9114c 100644 --- a/src/components/dialogs/hacs-form-dialog.ts +++ b/src/components/dialogs/hacs-form-dialog.ts @@ -26,6 +26,8 @@ class HacsFromDialog extends LitElement { @state() _errors?: Record; + @state() _forceLTR: boolean = false; + _errorSubscription: any; public async showDialog(dialogParams: HacsFormDialogParams): Promise { @@ -38,6 +40,7 @@ class HacsFromDialog extends LitElement { }, HacsDispatchEvent.ERROR, ); + this._forceLTR = dialogParams.forceLTR; await this.updateComplete; } @@ -64,6 +67,7 @@ class HacsFromDialog extends LitElement { ? createCloseHeading(this.hass, this._dialogParams.title) : this._dialogParams.title} @closed=${this.closeDialog} + class="${this._forceLTR ? "force-ltr" : ""}" >
${this._dialogParams.description || nothing} @@ -151,6 +155,9 @@ class HacsFromDialog extends LitElement { margin-bottom: -8px; margin-top: 4px; } + .force-ltr { + direction: ltr; + } `; } } diff --git a/src/components/dialogs/show-hacs-dialog.ts b/src/components/dialogs/show-hacs-dialog.ts index c3ac9affd..62d852c14 100644 --- a/src/components/dialogs/show-hacs-dialog.ts +++ b/src/components/dialogs/show-hacs-dialog.ts @@ -18,6 +18,7 @@ export interface HacsFormDialogParams extends BaseHacsDialogParams { saveLabel?: string; destructive?: boolean; description?: HTMLTemplateResult | string; + forceLTR: boolean; computeLabelCallback?: (schema: any, data: HaFormDataContainer) => string; computeHelper?: (schema: any) => string | undefined; computeError?: (schema: any, error) => string; @@ -33,7 +34,7 @@ export interface HacsCustomRepositoriesDialogParams extends BaseHacsDialogParams export const showHacsFormDialog = ( element: HTMLElement, - dialogParams: HacsFormDialogParams + dialogParams: HacsFormDialogParams, ): void => { fireEvent(element, "show-dialog", { dialogTag: "hacs-form-dialog", @@ -44,7 +45,7 @@ export const showHacsFormDialog = ( export const showHacsDownloadDialog = ( element: HTMLElement, - dialogParams: HacsDownloadDialogParams + dialogParams: HacsDownloadDialogParams, ): void => { fireEvent(element, "show-dialog", { dialogTag: "hacs-download-dialog", @@ -55,7 +56,7 @@ export const showHacsDownloadDialog = ( export const showHacsCustomRepositoriesDialog = ( element: HTMLElement, - dialogParams: HacsCustomRepositoriesDialogParams + dialogParams: HacsCustomRepositoriesDialogParams, ): void => { fireEvent(element, "show-dialog", { dialogTag: "hacs-custom-repositories-dialog", diff --git a/src/dashboards/hacs-dashboard.ts b/src/dashboards/hacs-dashboard.ts index a42c4bb4c..608281bcd 100644 --- a/src/dashboards/hacs-dashboard.ts +++ b/src/dashboards/hacs-dashboard.ts @@ -258,6 +258,7 @@ export class HacsDashboard extends LitElement { description: html``, + forceLTR: true, }); }} > diff --git a/src/dashboards/hacs-repository-dashboard.ts b/src/dashboards/hacs-repository-dashboard.ts index 7db2a7036..8a7cc1765 100644 --- a/src/dashboards/hacs-repository-dashboard.ts +++ b/src/dashboards/hacs-repository-dashboard.ts @@ -360,6 +360,7 @@ export class HacsRepositoryDashboard extends LitElement { margin: auto; padding: 8px; max-width: 1536px; + direction: ltr; } ha-chip-set { diff --git a/src/hacs.ts b/src/hacs.ts index adbd16b6f..50f32ffe6 100644 --- a/src/hacs.ts +++ b/src/hacs.ts @@ -9,6 +9,10 @@ import { computeLocalize } from "../homeassistant-frontend/src/common/translatio import { getTranslation } from "../homeassistant-frontend/src/util/common-translation"; import { fetchHacsInfo, getRepositories, websocketSubscription } from "./data/websocket"; import { HacsDispatchEvent } from "./data/common"; +import { + computeRTLDirection, + computeDirectionStyles, +} from "../homeassistant-frontend/src/common/util/compute_rtl"; export class HacsElement extends ProvideHassLitMixin(LitElement) { @property({ attribute: false }) public hacs: Partial = { localize: () => "" }; @@ -43,30 +47,30 @@ export class HacsElement extends ProvideHassLitMixin(LitElement) { websocketSubscription( this.hass, () => this._updateProperties("configuration"), - HacsDispatchEvent.CONFIG + HacsDispatchEvent.CONFIG, ); websocketSubscription( this.hass, () => this._updateProperties("status"), - HacsDispatchEvent.STATUS + HacsDispatchEvent.STATUS, ); websocketSubscription( this.hass, () => this._updateProperties("status"), - HacsDispatchEvent.STAGE + HacsDispatchEvent.STAGE, ); websocketSubscription( this.hass, () => this._updateProperties("repositories"), - HacsDispatchEvent.REPOSITORY + HacsDispatchEvent.REPOSITORY, ); this.hass.connection.subscribeEvents( async () => this._updateProperties("lovelace"), - "lovelace_updated" + "lovelace_updated", ); this._updateHacs({ @@ -76,12 +80,17 @@ export class HacsElement extends ProvideHassLitMixin(LitElement) { this._updateProperties(); this.addEventListener("update-hacs", (e) => - this._updateHacs((e as any).detail as Partial) + this._updateHacs((e as any).detail as Partial), ); } private async _initializeLocalize() { const { language, data } = await getTranslation(null, this._language); + + const dir = computeRTLDirection(this.hass); + window.document.documentElement.setAttribute("dir", dir); + computeDirectionStyles(dir === "rtl", this); + this._updateHacs({ localize: await computeLocalize(this.constructor.prototype, language, { [language]: data, From afd6b2787aeba86259b7f07a4e2cf3bcdfbf86d2 Mon Sep 17 00:00:00 2001 From: Yosi Levy <37745463+yosilevy@users.noreply.github.com> Date: Wed, 11 Feb 2026 18:27:16 +0200 Subject: [PATCH 2/3] Update src/components/dialogs/hacs-form-dialog.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/components/dialogs/hacs-form-dialog.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/dialogs/hacs-form-dialog.ts b/src/components/dialogs/hacs-form-dialog.ts index 988c9114c..0021e3aea 100644 --- a/src/components/dialogs/hacs-form-dialog.ts +++ b/src/components/dialogs/hacs-form-dialog.ts @@ -40,7 +40,7 @@ class HacsFromDialog extends LitElement { }, HacsDispatchEvent.ERROR, ); - this._forceLTR = dialogParams.forceLTR; + this._forceLTR = dialogParams.forceLTR ?? false; await this.updateComplete; } From 5bc5ff5cb260c62bf59683bdeae8c43f4b89365a Mon Sep 17 00:00:00 2001 From: Yosi Levy <37745463+yosilevy@users.noreply.github.com> Date: Wed, 11 Feb 2026 18:27:24 +0200 Subject: [PATCH 3/3] Update src/components/dialogs/show-hacs-dialog.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/components/dialogs/show-hacs-dialog.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/dialogs/show-hacs-dialog.ts b/src/components/dialogs/show-hacs-dialog.ts index 62d852c14..bd96e81b2 100644 --- a/src/components/dialogs/show-hacs-dialog.ts +++ b/src/components/dialogs/show-hacs-dialog.ts @@ -18,7 +18,7 @@ export interface HacsFormDialogParams extends BaseHacsDialogParams { saveLabel?: string; destructive?: boolean; description?: HTMLTemplateResult | string; - forceLTR: boolean; + forceLTR?: boolean; computeLabelCallback?: (schema: any, data: HaFormDataContainer) => string; computeHelper?: (schema: any) => string | undefined; computeError?: (schema: any, error) => string;