Fix keyboard for ha-config-entities bulk menus (#23776)

Fix keyboard for ha-config-entities menus
This commit is contained in:
karwosts 2025-01-23 03:15:23 -08:00 committed by GitHub
parent 666316e44a
commit fb79e2cfb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -729,7 +729,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
</ha-md-menu-item>`; </ha-md-menu-item>`;
})} })}
<ha-md-divider role="separator" tabindex="-1"></ha-md-divider> <ha-md-divider role="separator" tabindex="-1"></ha-md-divider>
<ha-md-menu-item @click=${this._bulkCreateLabel}> <ha-md-menu-item .clickAction=${this._bulkCreateLabel}>
<div slot="headline"> <div slot="headline">
${this.hass.localize("ui.panel.config.labels.add_label")} ${this.hass.localize("ui.panel.config.labels.add_label")}
</div></ha-md-menu-item </div></ha-md-menu-item
@ -844,7 +844,7 @@ ${
: nothing : nothing
} }
<ha-md-menu-item @click=${this._enableSelected}> <ha-md-menu-item .clickAction=${this._enableSelected}>
<ha-svg-icon slot="start" .path=${mdiToggleSwitch}></ha-svg-icon> <ha-svg-icon slot="start" .path=${mdiToggleSwitch}></ha-svg-icon>
<div slot="headline"> <div slot="headline">
${this.hass.localize( ${this.hass.localize(
@ -852,7 +852,7 @@ ${
)} )}
</div> </div>
</ha-md-menu-item> </ha-md-menu-item>
<ha-md-menu-item @click=${this._disableSelected}> <ha-md-menu-item .clickAction=${this._disableSelected}>
<ha-svg-icon <ha-svg-icon
slot="start" slot="start"
.path=${mdiToggleSwitchOffOutline} .path=${mdiToggleSwitchOffOutline}
@ -865,7 +865,7 @@ ${
</ha-md-menu-item> </ha-md-menu-item>
<ha-md-divider role="separator" tabindex="-1"></ha-md-divider> <ha-md-divider role="separator" tabindex="-1"></ha-md-divider>
<ha-md-menu-item @click=${this._unhideSelected}> <ha-md-menu-item .clickAction=${this._unhideSelected}>
<ha-svg-icon <ha-svg-icon
slot="start" slot="start"
.path=${mdiEye} .path=${mdiEye}
@ -876,7 +876,7 @@ ${
)} )}
</div> </div>
</ha-md-menu-item> </ha-md-menu-item>
<ha-md-menu-item @click=${this._hideSelected}> <ha-md-menu-item .clickAction=${this._hideSelected}>
<ha-svg-icon <ha-svg-icon
slot="start" slot="start"
.path=${mdiEyeOff} .path=${mdiEyeOff}
@ -889,7 +889,7 @@ ${
</ha-md-menu-item> </ha-md-menu-item>
<ha-md-divider role="separator" tabindex="-1"></ha-md-divider> <ha-md-divider role="separator" tabindex="-1"></ha-md-divider>
<ha-md-menu-item @click=${this._removeSelected} class="warning"> <ha-md-menu-item .clickAction=${this._removeSelected} class="warning">
<ha-svg-icon <ha-svg-icon
slot="start" slot="start"
.path=${mdiDelete} .path=${mdiDelete}
@ -1123,7 +1123,7 @@ ${
this._selected = ev.detail.value; this._selected = ev.detail.value;
} }
private async _enableSelected() { private _enableSelected = async () => {
showConfirmationDialog(this, { showConfirmationDialog(this, {
title: this.hass.localize( title: this.hass.localize(
"ui.panel.config.entities.picker.enable_selected.confirm_title", "ui.panel.config.entities.picker.enable_selected.confirm_title",
@ -1191,9 +1191,9 @@ ${
} }
}, },
}); });
} };
private _disableSelected() { private _disableSelected = () => {
showConfirmationDialog(this, { showConfirmationDialog(this, {
title: this.hass.localize( title: this.hass.localize(
"ui.panel.config.entities.picker.disable_selected.confirm_title", "ui.panel.config.entities.picker.disable_selected.confirm_title",
@ -1213,9 +1213,9 @@ ${
this._clearSelection(); this._clearSelection();
}, },
}); });
} };
private _hideSelected() { private _hideSelected = () => {
showConfirmationDialog(this, { showConfirmationDialog(this, {
title: this.hass.localize( title: this.hass.localize(
"ui.panel.config.entities.picker.hide_selected.confirm_title", "ui.panel.config.entities.picker.hide_selected.confirm_title",
@ -1235,16 +1235,16 @@ ${
this._clearSelection(); this._clearSelection();
}, },
}); });
} };
private _unhideSelected() { private _unhideSelected = () => {
this._selected.forEach((entity) => this._selected.forEach((entity) =>
updateEntityRegistryEntry(this.hass, entity, { updateEntityRegistryEntry(this.hass, entity, {
hidden_by: null, hidden_by: null,
}) })
); );
this._clearSelection(); this._clearSelection();
} };
private async _handleBulkLabel(ev) { private async _handleBulkLabel(ev) {
const label = ev.currentTarget.value; const label = ev.currentTarget.value;
@ -1286,7 +1286,7 @@ ${rejected
} }
} }
private _bulkCreateLabel() { private _bulkCreateLabel = () => {
showLabelDetailDialog(this, { showLabelDetailDialog(this, {
createEntry: async (values) => { createEntry: async (values) => {
const label = await createLabelRegistryEntry(this.hass, values); const label = await createLabelRegistryEntry(this.hass, values);
@ -1294,9 +1294,9 @@ ${rejected
return label; return label;
}, },
}); });
} };
private async _removeSelected() { private _removeSelected = async () => {
if (!this._entities || !this.hass) { if (!this._entities || !this.hass) {
return; return;
} }
@ -1369,7 +1369,7 @@ ${rejected
this._clearSelection(); this._clearSelection();
}, },
}); });
} };
private _clearSelection() { private _clearSelection() {
this._dataTable.clearSelection(); this._dataTable.clearSelection();