mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
🐛 make picture card tabbable only if action set (#4494)
* 🐛 make picture card tabbable only if action set * 👌use ifDefined and hasAction * ✏️ fix syntax mistake
This commit is contained in:
parent
eb9023595d
commit
67022b9ffc
@ -20,6 +20,7 @@ import { actionHandler } from "../common/directives/action-handler-directive";
|
|||||||
import { hasAction } from "../common/has-action";
|
import { hasAction } from "../common/has-action";
|
||||||
import { ActionHandlerEvent } from "../../../data/lovelace";
|
import { ActionHandlerEvent } from "../../../data/lovelace";
|
||||||
import { handleAction } from "../common/handle-action";
|
import { handleAction } from "../common/handle-action";
|
||||||
|
import { ifDefined } from "lit-html/directives/if-defined";
|
||||||
|
|
||||||
@customElement("hui-picture-card")
|
@customElement("hui-picture-card")
|
||||||
export class HuiPictureCard extends LitElement implements LovelaceCard {
|
export class HuiPictureCard extends LitElement implements LovelaceCard {
|
||||||
@ -86,10 +87,14 @@ export class HuiPictureCard extends LitElement implements LovelaceCard {
|
|||||||
hasHold: hasAction(this._config!.hold_action),
|
hasHold: hasAction(this._config!.hold_action),
|
||||||
hasDoubleClick: hasAction(this._config!.double_tap_action),
|
hasDoubleClick: hasAction(this._config!.double_tap_action),
|
||||||
})}
|
})}
|
||||||
tabindex="0"
|
tabindex=${ifDefined(
|
||||||
|
hasAction(this._config.tap_action) ? "0" : undefined
|
||||||
|
)}
|
||||||
class="${classMap({
|
class="${classMap({
|
||||||
clickable: Boolean(
|
clickable: Boolean(
|
||||||
this._config.tap_action || this._config.hold_action
|
this._config.tap_action ||
|
||||||
|
this._config.hold_action ||
|
||||||
|
this._config.double_tap_action
|
||||||
),
|
),
|
||||||
})}"
|
})}"
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user