Fix pointer cursor issues (#21587)

* Fix pointer cursor issues

* one more
This commit is contained in:
karwosts
2024-08-05 08:07:03 -07:00
committed by GitHub
parent 0adee7d189
commit 3ba572ee37
9 changed files with 31 additions and 37 deletions

View File

@@ -20,7 +20,7 @@ import { HomeAssistant } from "../../../types";
import { EntitiesCardEntityConfig } from "../cards/types";
import { actionHandler } from "../common/directives/action-handler-directive";
import { handleAction } from "../common/handle-action";
import { hasAction } from "../common/has-action";
import { hasAction, hasAnyAction } from "../common/has-action";
import { createEntityNotFoundWarning } from "./hui-warning";
@customElement("hui-generic-entity-row")
@@ -60,9 +60,7 @@ export class HuiGenericEntityRow extends LitElement {
// By default, we always show a pointer, since if there is no explicit configuration provided,
// the frontend always assumes "more-info" in the action handler. We only need to hide the pointer
// if the tap action is explicitly set to "none".
const pointer = !(
this.config.tap_action && this.config.tap_action.action === "none"
);
const pointer = hasAnyAction(this.config);
const hasSecondary = this.secondaryText || this.config.secondary_info;
const name = this.config.name ?? computeStateName(stateObj);
@@ -82,7 +80,11 @@ export class HuiGenericEntityRow extends LitElement {
hasHold: hasAction(this.config!.hold_action),
hasDoubleClick: hasAction(this.config!.double_tap_action),
})}
tabindex=${ifDefined(pointer ? "0" : undefined)}
tabindex=${ifDefined(
!this.config.tap_action || hasAction(this.config.tap_action)
? "0"
: undefined
)}
></state-badge>
${!this.hideName
? html`<div