Skip to content

Commit

Permalink
Fix keyboard for ha-config-entities bulk menus (#23776)
Browse files Browse the repository at this point in the history
Fix keyboard for ha-config-entities menus
  • Loading branch information
karwosts authored Jan 23, 2025
1 parent 666316e commit fb79e2c
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/panels/config/entities/ha-config-entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
</ha-md-menu-item>`;
})}
<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">
${this.hass.localize("ui.panel.config.labels.add_label")}
</div></ha-md-menu-item
Expand Down Expand Up @@ -844,15 +844,15 @@ ${
: 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>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.entities.picker.enable_selected.button"
)}
</div>
</ha-md-menu-item>
<ha-md-menu-item @click=${this._disableSelected}>
<ha-md-menu-item .clickAction=${this._disableSelected}>
<ha-svg-icon
slot="start"
.path=${mdiToggleSwitchOffOutline}
Expand All @@ -865,7 +865,7 @@ ${
</ha-md-menu-item>
<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
slot="start"
.path=${mdiEye}
Expand All @@ -876,7 +876,7 @@ ${
)}
</div>
</ha-md-menu-item>
<ha-md-menu-item @click=${this._hideSelected}>
<ha-md-menu-item .clickAction=${this._hideSelected}>
<ha-svg-icon
slot="start"
.path=${mdiEyeOff}
Expand All @@ -889,7 +889,7 @@ ${
</ha-md-menu-item>
<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
slot="start"
.path=${mdiDelete}
Expand Down Expand Up @@ -1123,7 +1123,7 @@ ${
this._selected = ev.detail.value;
}

private async _enableSelected() {
private _enableSelected = async () => {
showConfirmationDialog(this, {
title: this.hass.localize(
"ui.panel.config.entities.picker.enable_selected.confirm_title",
Expand Down Expand Up @@ -1191,9 +1191,9 @@ ${
}
},
});
}
};

private _disableSelected() {
private _disableSelected = () => {
showConfirmationDialog(this, {
title: this.hass.localize(
"ui.panel.config.entities.picker.disable_selected.confirm_title",
Expand All @@ -1213,9 +1213,9 @@ ${
this._clearSelection();
},
});
}
};

private _hideSelected() {
private _hideSelected = () => {
showConfirmationDialog(this, {
title: this.hass.localize(
"ui.panel.config.entities.picker.hide_selected.confirm_title",
Expand All @@ -1235,16 +1235,16 @@ ${
this._clearSelection();
},
});
}
};

private _unhideSelected() {
private _unhideSelected = () => {
this._selected.forEach((entity) =>
updateEntityRegistryEntry(this.hass, entity, {
hidden_by: null,
})
);
this._clearSelection();
}
};

private async _handleBulkLabel(ev) {
const label = ev.currentTarget.value;
Expand Down Expand Up @@ -1286,17 +1286,17 @@ ${rejected
}
}

private _bulkCreateLabel() {
private _bulkCreateLabel = () => {
showLabelDetailDialog(this, {
createEntry: async (values) => {
const label = await createLabelRegistryEntry(this.hass, values);
this._bulkLabel(label.label_id, "add");
return label;
},
});
}
};

private async _removeSelected() {
private _removeSelected = async () => {
if (!this._entities || !this.hass) {
return;
}
Expand Down Expand Up @@ -1369,7 +1369,7 @@ ${rejected
this._clearSelection();
},
});
}
};

private _clearSelection() {
this._dataTable.clearSelection();
Expand Down

0 comments on commit fb79e2c

Please sign in to comment.