${this.checked
@@ -164,16 +165,13 @@ export class HaControlSwitch extends LitElement {
width: 100%;
box-sizing: border-box;
user-select: none;
- cursor: pointer;
- border-radius: var(--control-switch-border-radius);
- outline: none;
transition: box-shadow 180ms ease-in-out;
-webkit-tap-highlight-color: transparent;
}
- :host(:focus-visible) {
+ .switch:focus-visible {
box-shadow: 0 0 0 2px var(--control-switch-off-color);
}
- :host([checked]:focus-visible) {
+ .switch[checked]:focus-visible {
box-shadow: 0 0 0 2px var(--control-switch-on-color);
}
.switch {
@@ -182,9 +180,15 @@ export class HaControlSwitch extends LitElement {
height: 100%;
width: 100%;
border-radius: var(--control-switch-border-radius);
+ outline: none;
overflow: hidden;
padding: var(--control-switch-padding);
display: flex;
+ cursor: pointer;
+ }
+ .switch[disabled] {
+ opacity: 0.5;
+ cursor: not-allowed;
}
.switch .background {
position: absolute;
@@ -212,24 +216,24 @@ export class HaControlSwitch extends LitElement {
align-items: center;
justify-content: center;
}
- :host([checked]) .switch .background {
+ .switch[checked] .background {
background-color: var(--control-switch-on-color);
}
- :host([checked]) .switch .button {
+ .switch[checked] .button {
transform: translateX(100%);
background-color: var(--control-switch-on-color);
}
:host([reversed]) .switch {
flex-direction: row-reverse;
}
- :host([reversed][checked]) .switch .button {
+ :host([reversed]) .switch[checked] .button {
transform: translateX(-100%);
}
:host([vertical]) {
width: var(--control-switch-thickness);
height: 100%;
}
- :host([vertical][checked]) .switch .button {
+ :host([vertical]) .switch[checked] .button {
transform: translateY(100%);
}
:host([vertical]) .switch .button {
@@ -239,13 +243,9 @@ export class HaControlSwitch extends LitElement {
:host([vertical][reversed]) .switch {
flex-direction: column-reverse;
}
- :host([vertical][reversed][checked]) .switch .button {
+ :host([vertical][reversed]) .switch[checked] .button {
transform: translateY(-100%);
}
- :host([disabled]) {
- opacity: 0.5;
- cursor: not-allowed;
- }
`;
}
diff --git a/src/dialogs/more-info/components/lights/light-color-temp-picker.ts b/src/dialogs/more-info/components/lights/light-color-temp-picker.ts
index 13c75f639c..eb3afdb6a5 100644
--- a/src/dialogs/more-info/components/lights/light-color-temp-picker.ts
+++ b/src/dialogs/more-info/components/lights/light-color-temp-picker.ts
@@ -79,7 +79,7 @@ class LightColorTempPicker extends LitElement {
mode="cursor"
@value-changed=${this._ctColorChanged}
@slider-moved=${this._ctColorCursorMoved}
- .ariaLabel=${this.hass.localize(
+ .label=${this.hass.localize(
"ui.dialogs.more_info_control.light.color_temp"
)}
style=${styleMap({
diff --git a/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts
index 13524cac99..c537696c41 100644
--- a/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts
+++ b/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts
@@ -174,10 +174,8 @@ class HuiAlarmModeCardFeature
.options=${options}
.value=${this._currentMode}
@value-changed=${this._valueChanged}
- hide-label
- .ariaLabel=${this.hass.localize(
- "ui.card.alarm_control_panel.modes_label"
- )}
+ hide-option-label
+ .label=${this.hass.localize("ui.card.alarm_control_panel.modes_label")}
style=${styleMap({
"--control-select-color": color,
"--modes-count": options.length.toString(),
diff --git a/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts
index 7ba6cab9e0..1880cbd0f4 100644
--- a/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts
+++ b/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts
@@ -174,11 +174,8 @@ class HuiClimateFanModesCardFeature
.options=${options}
.value=${this._currentFanMode}
@value-changed=${this._valueChanged}
- hide-label
- .ariaLabel=${this.hass!.formatEntityAttributeName(
- stateObj,
- "fan_mode"
- )}
+ hide-option-label
+ .label=${this.hass!.formatEntityAttributeName(stateObj, "fan_mode")}
.disabled=${this._stateObj!.state === UNAVAILABLE}
>
diff --git a/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts
index 16168289f7..a55b8de38f 100644
--- a/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts
+++ b/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts
@@ -205,8 +205,8 @@ class HuiClimateHvacModesCardFeature
.options=${options}
.value=${this._currentHvacMode}
@value-changed=${this._valueChanged}
- hide-label
- .ariaLabel=${this.hass.localize("ui.card.climate.mode")}
+ hide-option-label
+ .label=${this.hass.localize("ui.card.climate.mode")}
style=${styleMap({
"--control-select-color": color,
})}
diff --git a/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts
index 38a49b2549..2d0c604dea 100644
--- a/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts
+++ b/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts
@@ -176,8 +176,8 @@ class HuiClimatePresetModesCardFeature
.options=${options}
.value=${this._currentPresetMode}
@value-changed=${this._valueChanged}
- hide-label
- .ariaLabel=${this.hass!.formatEntityAttributeName(
+ hide-option-label
+ .label=${this.hass!.formatEntityAttributeName(
stateObj,
"preset_mode"
)}
diff --git a/src/panels/lovelace/card-features/hui-climate-swing-horizontal-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-swing-horizontal-modes-card-feature.ts
index 5b7c5dd127..325c25f962 100644
--- a/src/panels/lovelace/card-features/hui-climate-swing-horizontal-modes-card-feature.ts
+++ b/src/panels/lovelace/card-features/hui-climate-swing-horizontal-modes-card-feature.ts
@@ -178,8 +178,8 @@ class HuiClimateSwingHorizontalModesCardFeature
.options=${options}
.value=${this._currentSwingHorizontalMode}
@value-changed=${this._valueChanged}
- hide-label
- .ariaLabel=${this.hass!.formatEntityAttributeName(
+ hide-option-label
+ .label=${this.hass!.formatEntityAttributeName(
stateObj,
"swing_horizontal_mode"
)}
diff --git a/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts
index df16f90064..9a0574dd46 100644
--- a/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts
+++ b/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts
@@ -176,7 +176,7 @@ class HuiClimateSwingModesCardFeature
.options=${options}
.value=${this._currentSwingMode}
@value-changed=${this._valueChanged}
- hide-label
+ hide-option-label
.ariaLabel=${this.hass!.formatEntityAttributeName(
stateObj,
"swing_mode"
diff --git a/src/panels/lovelace/card-features/hui-cover-position-card-feature.ts b/src/panels/lovelace/card-features/hui-cover-position-card-feature.ts
index 81731ef8f0..d23ea7a06a 100644
--- a/src/panels/lovelace/card-features/hui-cover-position-card-feature.ts
+++ b/src/panels/lovelace/card-features/hui-cover-position-card-feature.ts
@@ -106,7 +106,7 @@ class HuiCoverPositionCardFeature
inverted
show-handle
@value-changed=${this._valueChanged}
- .ariaLabel=${computeAttributeNameDisplay(
+ .label=${computeAttributeNameDisplay(
this.hass.localize,
this._stateObj,
this.hass.entities,
diff --git a/src/panels/lovelace/card-features/hui-cover-tilt-position-card-feature.ts b/src/panels/lovelace/card-features/hui-cover-tilt-position-card-feature.ts
index 15c4a5f154..cd8300e077 100644
--- a/src/panels/lovelace/card-features/hui-cover-tilt-position-card-feature.ts
+++ b/src/panels/lovelace/card-features/hui-cover-tilt-position-card-feature.ts
@@ -105,7 +105,7 @@ class HuiCoverTiltPositionCardFeature
mode="cursor"
inverted
@value-changed=${this._valueChanged}
- .ariaLabel=${computeAttributeNameDisplay(
+ .label=${computeAttributeNameDisplay(
this.hass.localize,
this._stateObj,
this.hass.entities,
diff --git a/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts
index bd70400778..c263584a8a 100644
--- a/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts
+++ b/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts
@@ -170,8 +170,8 @@ class HuiFanPresetModesCardFeature
.options=${options}
.value=${this._currentPresetMode}
@value-changed=${this._valueChanged}
- hide-label
- .ariaLabel=${this.hass!.formatEntityAttributeName(
+ hide-option-label
+ .label=${this.hass!.formatEntityAttributeName(
stateObj,
"preset_mode"
)}
diff --git a/src/panels/lovelace/card-features/hui-fan-speed-card-feature.ts b/src/panels/lovelace/card-features/hui-fan-speed-card-feature.ts
index a809a124ee..b4b4b18b11 100644
--- a/src/panels/lovelace/card-features/hui-fan-speed-card-feature.ts
+++ b/src/panels/lovelace/card-features/hui-fan-speed-card-feature.ts
@@ -109,8 +109,8 @@ class HuiFanSpeedCardFeature extends LitElement implements LovelaceCardFeature {
.options=${options}
.value=${speed}
@value-changed=${this._speedValueChanged}
- hide-label
- .ariaLabel=${computeAttributeNameDisplay(
+ hide-option-label
+ .label=${computeAttributeNameDisplay(
this.hass.localize,
this._stateObj,
this.hass.entities,
@@ -131,7 +131,7 @@ class HuiFanSpeedCardFeature extends LitElement implements LovelaceCardFeature {
max="100"
.step=${this._stateObj.attributes.percentage_step ?? 1}
@value-changed=${this._valueChanged}
- .ariaLabel=${computeAttributeNameDisplay(
+ .label=${computeAttributeNameDisplay(
this.hass.localize,
this._stateObj,
this.hass.entities,
diff --git a/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts
index 82e4c4dc37..e0065ce880 100644
--- a/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts
+++ b/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts
@@ -174,8 +174,8 @@ class HuiHumidifierModesCardFeature
.options=${options}
.value=${this._currentMode}
@value-changed=${this._valueChanged}
- hide-label
- .ariaLabel=${this.hass!.formatEntityAttributeName(stateObj, "mode")}
+ hide-option-label
+ .label=${this.hass!.formatEntityAttributeName(stateObj, "mode")}
.disabled=${this._stateObj!.state === UNAVAILABLE}
>
diff --git a/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts b/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts
index 4cff297c96..2888030400 100644
--- a/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts
+++ b/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts
@@ -130,8 +130,8 @@ class HuiHumidifierToggleCardFeature
.options=${options}
.value=${this._currentState}
@value-changed=${this._valueChanged}
- hide-label
- .ariaLabel=${this.hass.localize("ui.card.humidifier.state")}
+ hide-option-label
+ .label=${this.hass.localize("ui.card.humidifier.state")}
style=${styleMap({
"--control-select-color": color,
})}
diff --git a/src/panels/lovelace/card-features/hui-toggle-card-feature.ts b/src/panels/lovelace/card-features/hui-toggle-card-feature.ts
index c82eb59085..925627c991 100644
--- a/src/panels/lovelace/card-features/hui-toggle-card-feature.ts
+++ b/src/panels/lovelace/card-features/hui-toggle-card-feature.ts
@@ -185,7 +185,7 @@ class HuiToggleCardFeature extends LitElement implements LovelaceCardFeature {
.pathOff=${offIcon}
.checked=${isOn}
@change=${this._valueChanged}
- .ariaLabel=${this.hass.localize("ui.card.common.toggle")}
+ .label=${this.hass.localize("ui.card.common.toggle")}
.disabled=${this._stateObj.state === UNAVAILABLE}
>
diff --git a/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts
index 2f61d1ac95..7f28354ad6 100644
--- a/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts
+++ b/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts
@@ -151,8 +151,8 @@ class HuiWaterHeaterOperationModeCardFeature
.options=${options}
.value=${this._currentOperationMode}
@value-changed=${this._valueChanged}
- hide-label
- .ariaLabel=${this.hass.localize("ui.card.water_heater.mode")}
+ hide-option-label
+ .label=${this.hass.localize("ui.card.water_heater.mode")}
style=${styleMap({
"--control-select-color": color,
})}
diff --git a/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts b/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts
index 26f58ca468..85051be65b 100644
--- a/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts
+++ b/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts
@@ -87,9 +87,7 @@ export class HaStateControlAlarmControlPanelModes extends LitElement {
.options=${options}
.value=${this._currentMode}
@value-changed=${this._valueChanged}
- .ariaLabel=${this.hass.localize(
- "ui.card.alarm_control_panel.modes_label"
- )}
+ .label=${this.hass.localize("ui.card.alarm_control_panel.modes_label")}
style=${styleMap({
"--control-select-color": color,
"--modes-count": modes.length.toString(),
diff --git a/src/state-control/cover/ha-state-control-cover-position.ts b/src/state-control/cover/ha-state-control-cover-position.ts
index c798ff0de3..dcf69d829a 100644
--- a/src/state-control/cover/ha-state-control-cover-position.ts
+++ b/src/state-control/cover/ha-state-control-cover-position.ts
@@ -50,7 +50,7 @@ export class HaStateControlCoverPosition extends LitElement {
show-handle
mode="end"
@value-changed=${this._valueChanged}
- .ariaLabel=${computeAttributeNameDisplay(
+ .label=${computeAttributeNameDisplay(
this.hass.localize,
this.stateObj,
this.hass.entities,
diff --git a/src/state-control/cover/ha-state-control-cover-tilt-position.ts b/src/state-control/cover/ha-state-control-cover-tilt-position.ts
index 4d93740a7f..1df89c3191 100644
--- a/src/state-control/cover/ha-state-control-cover-tilt-position.ts
+++ b/src/state-control/cover/ha-state-control-cover-tilt-position.ts
@@ -79,7 +79,7 @@ export class HaStateControlInfoCoverTiltPosition extends LitElement {
max="100"
mode="cursor"
@value-changed=${this._valueChanged}
- .ariaLabel=${computeAttributeNameDisplay(
+ .label=${computeAttributeNameDisplay(
this.hass.localize,
this.stateObj,
this.hass.entities,
diff --git a/src/state-control/cover/ha-state-control-cover-toggle.ts b/src/state-control/cover/ha-state-control-cover-toggle.ts
index 071c15c758..e8d5006daf 100644
--- a/src/state-control/cover/ha-state-control-cover-toggle.ts
+++ b/src/state-control/cover/ha-state-control-cover-toggle.ts
@@ -112,7 +112,7 @@ export class HaStateControlCoverToggle extends LitElement {
reversed
.checked=${isOn}
@change=${this._valueChanged}
- .ariaLabel=${isOn
+ .label=${isOn
? this.hass.localize("ui.card.cover.close_cover")
: this.hass.localize("ui.card.cover.open_cover")}
style=${styleMap({
diff --git a/src/state-control/fan/ha-state-control-fan-speed.ts b/src/state-control/fan/ha-state-control-fan-speed.ts
index e9c0b69321..c5659b08d0 100644
--- a/src/state-control/fan/ha-state-control-fan-speed.ts
+++ b/src/state-control/fan/ha-state-control-fan-speed.ts
@@ -92,7 +92,7 @@ export class HaStateControlFanSpeed extends LitElement {
.options=${options}
.value=${this.speedValue}
@value-changed=${this._speedValueChanged}
- .ariaLabel=${computeAttributeNameDisplay(
+ .label=${computeAttributeNameDisplay(
this.hass.localize,
this.stateObj,
this.hass.entities,
@@ -117,7 +117,7 @@ export class HaStateControlFanSpeed extends LitElement {
.value=${this.sliderValue}
.step=${this.stateObj.attributes.percentage_step ?? 1}
@value-changed=${this._valueChanged}
- .ariaLabel=${computeAttributeNameDisplay(
+ .label=${computeAttributeNameDisplay(
this.hass.localize,
this.stateObj,
this.hass.entities,
diff --git a/src/state-control/ha-state-control-toggle.ts b/src/state-control/ha-state-control-toggle.ts
index 0fcf4eef38..b8488f048f 100644
--- a/src/state-control/ha-state-control-toggle.ts
+++ b/src/state-control/ha-state-control-toggle.ts
@@ -117,7 +117,7 @@ export class HaStateControlToggle extends LitElement {
.checked=${isOn}
.showHandle=${stateActive(this.stateObj)}
@change=${this._valueChanged}
- .ariaLabel=${this.hass.localize("ui.card.common.toggle")}
+ .label=${this.hass.localize("ui.card.common.toggle")}
style=${styleMap({
"--control-switch-on-color": onColor,
"--control-switch-off-color": offColor,
diff --git a/src/state-control/light/ha-state-control-light-brightness.ts b/src/state-control/light/ha-state-control-light-brightness.ts
index 0039ed8611..e6a1128f40 100644
--- a/src/state-control/light/ha-state-control-light-brightness.ts
+++ b/src/state-control/light/ha-state-control-light-brightness.ts
@@ -67,7 +67,7 @@ export class HaStateControlLightBrightness extends LitElement {
max="100"
.showHandle=${stateActive(this.stateObj)}
@value-changed=${this._valueChanged}
- .ariaLabel=${this.hass.formatEntityAttributeName(
+ .label=${this.hass.formatEntityAttributeName(
this.stateObj,
"brightness"
)}
diff --git a/src/state-control/lock/ha-state-control-lock-toggle.ts b/src/state-control/lock/ha-state-control-lock-toggle.ts
index c7cb21216b..1fadf76ddc 100644
--- a/src/state-control/lock/ha-state-control-lock-toggle.ts
+++ b/src/state-control/lock/ha-state-control-lock-toggle.ts
@@ -118,7 +118,7 @@ export class HaStateControlLockToggle extends LitElement {
reversed
.checked=${this._isOn}
@change=${this._valueChanged}
- .ariaLabel=${this._isOn
+ .label=${this._isOn
? this.hass.localize("ui.card.lock.unlock")
: this.hass.localize("ui.card.lock.lock")}
style=${styleMap({
diff --git a/src/state-control/valve/ha-state-control-valve-position.ts b/src/state-control/valve/ha-state-control-valve-position.ts
index eef5460c86..346d064c22 100644
--- a/src/state-control/valve/ha-state-control-valve-position.ts
+++ b/src/state-control/valve/ha-state-control-valve-position.ts
@@ -48,7 +48,7 @@ export class HaStateControlValvePosition extends LitElement {
max="100"
show-handle
@value-changed=${this._valueChanged}
- .ariaLabel=${computeAttributeNameDisplay(
+ .label=${computeAttributeNameDisplay(
this.hass.localize,
this.stateObj,
this.hass.entities,
diff --git a/src/state-control/valve/ha-state-control-valve-toggle.ts b/src/state-control/valve/ha-state-control-valve-toggle.ts
index e476b3bd58..6dac262b4b 100644
--- a/src/state-control/valve/ha-state-control-valve-toggle.ts
+++ b/src/state-control/valve/ha-state-control-valve-toggle.ts
@@ -112,7 +112,7 @@ export class HaStateControlValveToggle extends LitElement {
reversed
.checked=${isOn}
@change=${this._valueChanged}
- .ariaLabel=${isOn
+ .label=${isOn
? this.hass.localize("ui.card.valve.close_valve")
: this.hass.localize("ui.card.valve.open_valve")}
style=${styleMap({