From 33ec1e15a99c91442f1fd52547e1131c1d78c0b7 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Fri, 31 Mar 2023 15:57:35 +0200 Subject: [PATCH] Fix labels on new more info (#15983) --- src/components/ha-control-select.ts | 2 -- .../ha-more-info-alarm_control_panel-modes.ts | 10 ++++------ .../more-info/components/fan/ha-more-info-fan-speed.ts | 3 ++- .../tile-features/hui-alarm-modes-tile-feature.ts | 10 ++++------ .../tile-features/hui-fan-speed-tile-feature.ts | 7 ++++--- src/translations/en.json | 3 ++- 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/components/ha-control-select.ts b/src/components/ha-control-select.ts index 6330ef4e9e..4aff82ac15 100644 --- a/src/components/ha-control-select.ts +++ b/src/components/ha-control-select.ts @@ -25,8 +25,6 @@ export type ControlSelectOption = { export class HaControlSelect extends LitElement { @property({ type: Boolean, reflect: true }) disabled = false; - @property() public label?: string; - @property() public options?: ControlSelectOption[]; @property() public value?: string; diff --git a/src/dialogs/more-info/components/alarm_control_panel/ha-more-info-alarm_control_panel-modes.ts b/src/dialogs/more-info/components/alarm_control_panel/ha-more-info-alarm_control_panel-modes.ts index acb085dde0..4e3ade78e1 100644 --- a/src/dialogs/more-info/components/alarm_control_panel/ha-more-info-alarm_control_panel-modes.ts +++ b/src/dialogs/more-info/components/alarm_control_panel/ha-more-info-alarm_control_panel-modes.ts @@ -2,7 +2,6 @@ import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; -import { computeAttributeNameDisplay } from "../../../../common/entity/compute_attribute_display"; import { stateColorCss } from "../../../../common/entity/state_color"; import { supportsFeature } from "../../../../common/entity/supports-feature"; import "../../../../components/ha-control-select"; @@ -13,6 +12,7 @@ import { AlarmMode, ALARM_MODES, } from "../../../../data/alarm_control_panel"; +import { UNAVAILABLE } from "../../../../data/entity"; import { HomeAssistant } from "../../../../types"; import { showEnterCodeDialogDialog } from "./show-enter-code-dialog"; @@ -117,16 +117,14 @@ export class HaMoreInfoAlarmControlPanelModes extends LitElement { .options=${options} .value=${this._currentMode} @value-changed=${this._valueChanged} - .label=${computeAttributeNameDisplay( - this.hass.localize, - this.stateObj, - this.hass.entities, - "percentage" + .ariaLabel=${this.hass.localize( + "ui.dialogs.more_info_control.alarm_control_panel.modes_label" )} style=${styleMap({ "--control-select-color": color, "--modes-count": modes.length.toString(), })} + .disabled=${this.stateObj!.state === UNAVAILABLE} > `; diff --git a/src/dialogs/more-info/components/fan/ha-more-info-fan-speed.ts b/src/dialogs/more-info/components/fan/ha-more-info-fan-speed.ts index 54bc13b937..4762796e1b 100644 --- a/src/dialogs/more-info/components/fan/ha-more-info-fan-speed.ts +++ b/src/dialogs/more-info/components/fan/ha-more-info-fan-speed.ts @@ -108,6 +108,7 @@ export class HaMoreInfoFanSpeed extends LitElement { style=${styleMap({ "--control-select-color": color, })} + .disabled=${this.stateObj.state === UNAVAILABLE} > `; @@ -116,9 +117,9 @@ export class HaMoreInfoFanSpeed extends LitElement { return html` diff --git a/src/panels/lovelace/tile-features/hui-fan-speed-tile-feature.ts b/src/panels/lovelace/tile-features/hui-fan-speed-tile-feature.ts index 5a67ea5bf1..1cca802015 100644 --- a/src/panels/lovelace/tile-features/hui-fan-speed-tile-feature.ts +++ b/src/panels/lovelace/tile-features/hui-fan-speed-tile-feature.ts @@ -100,12 +100,13 @@ class HuiFanSpeedTileFeature extends LitElement implements LovelaceTileFeature { .value=${speed} @value-changed=${this._speedValueChanged} hide-label - .label=${computeAttributeNameDisplay( + .ariaLabel=${computeAttributeNameDisplay( this.hass.localize, this.stateObj, this.hass.entities, "percentage" )} + .disabled=${this.stateObj!.state === UNAVAILABLE} > @@ -124,14 +125,14 @@ class HuiFanSpeedTileFeature extends LitElement implements LovelaceTileFeature { min="0" max="100" .step=${this.stateObj.attributes.percentage_step ?? 1} - .disabled=${this.stateObj!.state === UNAVAILABLE} @value-changed=${this._valueChanged} - .label=${computeAttributeNameDisplay( + .ariaLabel=${computeAttributeNameDisplay( this.hass.localize, this.stateObj, this.hass.entities, "percentage" )} + .disabled=${this.stateObj!.state === UNAVAILABLE} > `; diff --git a/src/translations/en.json b/src/translations/en.json index f72f6330e7..f3c01350f1 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -929,6 +929,7 @@ } }, "alarm_control_panel": { + "modes_label": "Modes", "modes": { "away": "Away", "home": "Home", @@ -4463,7 +4464,7 @@ }, "alarm-modes": { "label": "Alarm modes", - "modes": "Modes", + "modes": "[%key:ui::dialogs::more_info_control::alarm_control_panel::modes_label%]", "modes_list": { "away": "[%key:ui::dialogs::more_info_control::alarm_control_panel::modes::away%]", "home": "[%key:ui::dialogs::more_info_control::alarm_control_panel::modes::home%]",