Fix disabled language picker (#25278)

This commit is contained in:
karwosts 2025-05-02 06:19:12 -07:00 committed by GitHub
parent b0d4c699db
commit b4f1c8755d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -102,7 +102,7 @@ export class HaLanguagePicker extends LitElement {
localeChanged localeChanged
) { ) {
this._select.layoutOptions(); this._select.layoutOptions();
if (this._select.value !== this.value) { if (!this.disabled && this._select.value !== this.value) {
fireEvent(this, "value-changed", { value: this._select.value }); fireEvent(this, "value-changed", { value: this._select.value });
} }
if (!this.value) { if (!this.value) {
@ -141,7 +141,10 @@ export class HaLanguagePicker extends LitElement {
); );
const value = const value =
this.value ?? (this.required ? languageOptions[0]?.value : this.value); this.value ??
(this.required && !this.disabled
? languageOptions[0]?.value
: this.value);
return html` return html`
<ha-select <ha-select
@ -182,7 +185,7 @@ export class HaLanguagePicker extends LitElement {
private _changed(ev): void { private _changed(ev): void {
const target = ev.target as HaSelect; const target = ev.target as HaSelect;
if (target.value === "" || target.value === this.value) { if (this.disabled || target.value === "" || target.value === this.value) {
return; return;
} }
this.value = target.value; this.value = target.value;