mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-29 04:06:35 +00:00
♿ only set tabindex if tap_action defined (#4511)
This commit is contained in:
parent
b01bdec973
commit
28511d0cbf
@ -7,6 +7,7 @@ import {
|
||||
CSSResult,
|
||||
css,
|
||||
} from "lit-element";
|
||||
import { ifDefined } from "lit-html/directives/if-defined";
|
||||
|
||||
import "../../../components/entity/ha-state-label-badge";
|
||||
import "../components/hui-warning-element";
|
||||
@ -47,7 +48,9 @@ export class HuiStateLabelBadge extends LitElement implements LovelaceBadge {
|
||||
hasHold: hasAction(this._config!.hold_action),
|
||||
hasDoubleClick: hasAction(this._config!.double_tap_action),
|
||||
})}
|
||||
tabindex="0"
|
||||
tabindex=${ifDefined(
|
||||
hasAction(this._config.tap_action) ? "0" : undefined
|
||||
)}
|
||||
></ha-state-label-badge>
|
||||
`;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import {
|
||||
} from "lit-element";
|
||||
import { HassEntity } from "home-assistant-js-websocket";
|
||||
import { styleMap } from "lit-html/directives/style-map";
|
||||
import { ifDefined } from "lit-html/directives/if-defined";
|
||||
import "@material/mwc-ripple";
|
||||
|
||||
import "../../../components/ha-card";
|
||||
@ -134,7 +135,9 @@ class HuiEntityButtonCard extends LitElement implements LovelaceCard {
|
||||
hasHold: hasAction(this._config!.hold_action),
|
||||
hasDoubleClick: hasAction(this._config!.double_tap_action),
|
||||
})}
|
||||
tabindex="0"
|
||||
tabindex=${ifDefined(
|
||||
hasAction(this._config.tap_action) ? "0" : undefined
|
||||
)}
|
||||
>
|
||||
${this._config.show_icon
|
||||
? html`
|
||||
|
@ -9,6 +9,7 @@ import {
|
||||
CSSResult,
|
||||
} from "lit-element";
|
||||
import { classMap } from "lit-html/directives/class-map";
|
||||
import { ifDefined } from "lit-html/directives/if-defined";
|
||||
|
||||
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||
import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element";
|
||||
@ -214,7 +215,9 @@ export class HuiGlanceCard extends LitElement implements LovelaceCard {
|
||||
hasHold: hasAction(entityConf.hold_action),
|
||||
hasDoubleClick: hasAction(entityConf.double_tap_action),
|
||||
})}
|
||||
tabindex="0"
|
||||
tabindex=${ifDefined(
|
||||
hasAction(entityConf.tap_action) ? "0" : undefined
|
||||
)}
|
||||
>
|
||||
${this._config!.show_name !== false
|
||||
? html`
|
||||
|
@ -8,6 +8,7 @@ import {
|
||||
CSSResult,
|
||||
PropertyValues,
|
||||
} from "lit-element";
|
||||
import { ifDefined } from "lit-html/directives/if-defined";
|
||||
|
||||
import "../../../components/ha-card";
|
||||
|
||||
@ -20,7 +21,6 @@ import { actionHandler } from "../common/directives/action-handler-directive";
|
||||
import { hasAction } from "../common/has-action";
|
||||
import { ActionHandlerEvent } from "../../../data/lovelace";
|
||||
import { handleAction } from "../common/handle-action";
|
||||
import { ifDefined } from "lit-html/directives/if-defined";
|
||||
|
||||
@customElement("hui-picture-card")
|
||||
export class HuiPictureCard extends LitElement implements LovelaceCard {
|
||||
|
@ -9,6 +9,7 @@ import {
|
||||
PropertyValues,
|
||||
} from "lit-element";
|
||||
import { classMap } from "lit-html/directives/class-map";
|
||||
import { ifDefined } from "lit-html/directives/if-defined";
|
||||
|
||||
import "../../../components/ha-card";
|
||||
import "../components/hui-image";
|
||||
@ -156,7 +157,9 @@ class HuiPictureEntityCard extends LitElement implements LovelaceCard {
|
||||
hasHold: hasAction(this._config!.hold_action),
|
||||
hasDoubleClick: hasAction(this._config!.double_tap_action),
|
||||
})}
|
||||
tabindex="0"
|
||||
tabindex=${ifDefined(
|
||||
hasAction(this._config.tap_action) ? "0" : undefined
|
||||
)}
|
||||
class=${classMap({
|
||||
clickable: stateObj.state !== UNAVAILABLE,
|
||||
})}
|
||||
|
@ -9,6 +9,7 @@ import {
|
||||
PropertyValues,
|
||||
} from "lit-element";
|
||||
import { classMap } from "lit-html/directives/class-map";
|
||||
import { ifDefined } from "lit-html/directives/if-defined";
|
||||
|
||||
import "../../../components/ha-card";
|
||||
import "../../../components/ha-icon";
|
||||
@ -168,7 +169,9 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
|
||||
hasHold: hasAction(this._config!.hold_action),
|
||||
hasDoubleClick: hasAction(this._config!.double_tap_action),
|
||||
})}
|
||||
tabindex="0"
|
||||
tabindex=${ifDefined(
|
||||
hasAction(this._config.tap_action) ? "0" : undefined
|
||||
)}
|
||||
.config=${this._config}
|
||||
.hass=${this.hass}
|
||||
.image=${this._config.image}
|
||||
@ -231,7 +234,9 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
|
||||
hasHold: hasAction(entityConf.hold_action),
|
||||
hasDoubleClick: hasAction(entityConf.double_tap_action),
|
||||
})}
|
||||
tabindex="0"
|
||||
tabindex=${ifDefined(
|
||||
hasAction(entityConf.tap_action) ? "0" : undefined
|
||||
)}
|
||||
.config=${entityConf}
|
||||
class="${classMap({
|
||||
"state-on": !STATES_OFF.has(stateObj.state),
|
||||
|
@ -8,6 +8,7 @@ import {
|
||||
property,
|
||||
TemplateResult,
|
||||
} from "lit-element";
|
||||
import { ifDefined } from "lit-html/directives/if-defined";
|
||||
|
||||
import "../../../components/entity/state-badge";
|
||||
import "../../../components/ha-relative-time";
|
||||
@ -72,7 +73,9 @@ class HuiGenericEntityRow extends LitElement {
|
||||
hasHold: hasAction(this.config!.hold_action),
|
||||
hasDoubleClick: hasAction(this.config!.double_tap_action),
|
||||
})}
|
||||
tabindex="0"
|
||||
tabindex=${ifDefined(
|
||||
hasAction(this.config.tap_action) ? "0" : undefined
|
||||
)}
|
||||
></state-badge>
|
||||
<div class="flex">
|
||||
<div
|
||||
|
@ -7,6 +7,7 @@ import {
|
||||
CSSResult,
|
||||
customElement,
|
||||
} from "lit-element";
|
||||
import { ifDefined } from "lit-html/directives/if-defined";
|
||||
|
||||
import "../../../components/ha-icon";
|
||||
|
||||
@ -45,7 +46,9 @@ export class HuiIconElement extends LitElement implements LovelaceElement {
|
||||
hasHold: hasAction(this._config!.hold_action),
|
||||
hasDoubleClick: hasAction(this._config!.double_tap_action),
|
||||
})}
|
||||
tabindex="0"
|
||||
tabindex=${ifDefined(
|
||||
hasAction(this._config.tap_action) ? "0" : undefined
|
||||
)}
|
||||
></ha-icon>
|
||||
`;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import {
|
||||
css,
|
||||
CSSResult,
|
||||
} from "lit-element";
|
||||
import { ifDefined } from "lit-html/directives/if-defined";
|
||||
|
||||
import "../components/hui-image";
|
||||
|
||||
@ -56,7 +57,9 @@ export class HuiImageElement extends LitElement implements LovelaceElement {
|
||||
hasHold: hasAction(this._config!.hold_action),
|
||||
hasDoubleClick: hasAction(this._config!.double_tap_action),
|
||||
})}
|
||||
tabindex="0"
|
||||
tabindex=${ifDefined(
|
||||
hasAction(this._config.tap_action) ? "0" : undefined
|
||||
)}
|
||||
></hui-image>
|
||||
`;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import {
|
||||
property,
|
||||
PropertyValues,
|
||||
} from "lit-element";
|
||||
import { ifDefined } from "lit-html/directives/if-defined";
|
||||
|
||||
import "../../../components/entity/ha-state-label-badge";
|
||||
import "../components/hui-warning-element";
|
||||
@ -70,7 +71,9 @@ export class HuiStateBadgeElement extends LitElement
|
||||
hasHold: hasAction(this._config!.hold_action),
|
||||
hasDoubleClick: hasAction(this._config!.double_tap_action),
|
||||
})}
|
||||
tabindex="0"
|
||||
tabindex=${ifDefined(
|
||||
hasAction(this._config.tap_action) ? "0" : undefined
|
||||
)}
|
||||
></ha-state-label-badge>
|
||||
`;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import {
|
||||
CSSResult,
|
||||
PropertyValues,
|
||||
} from "lit-element";
|
||||
import { ifDefined } from "lit-html/directives/if-defined";
|
||||
|
||||
import "../../../components/entity/state-badge";
|
||||
import "../components/hui-warning-element";
|
||||
@ -66,7 +67,9 @@ export class HuiStateIconElement extends LitElement implements LovelaceElement {
|
||||
hasHold: hasAction(this._config!.hold_action),
|
||||
hasDoubleClick: hasAction(this._config!.double_tap_action),
|
||||
})}
|
||||
tabindex="0"
|
||||
tabindex=${ifDefined(
|
||||
hasAction(this._config.tap_action) ? "0" : undefined
|
||||
)}
|
||||
.overrideIcon=${this._config.icon}
|
||||
></state-badge>
|
||||
`;
|
||||
|
@ -8,6 +8,7 @@ import {
|
||||
CSSResult,
|
||||
PropertyValues,
|
||||
} from "lit-element";
|
||||
import { ifDefined } from "lit-html/directives/if-defined";
|
||||
|
||||
import "../components/hui-warning-element";
|
||||
|
||||
@ -65,7 +66,9 @@ class HuiStateLabelElement extends LitElement implements LovelaceElement {
|
||||
hasHold: hasAction(this._config!.hold_action),
|
||||
hasDoubleClick: hasAction(this._config!.double_tap_action),
|
||||
})}
|
||||
tabindex="0"
|
||||
tabindex=${ifDefined(
|
||||
hasAction(this._config.tap_action) ? "0" : undefined
|
||||
)}
|
||||
>
|
||||
${this._config.prefix}${stateObj
|
||||
? computeStateDisplay(
|
||||
|
@ -8,6 +8,7 @@ import {
|
||||
customElement,
|
||||
PropertyValues,
|
||||
} from "lit-element";
|
||||
import { ifDefined } from "lit-html/directives/if-defined";
|
||||
import "@polymer/paper-item/paper-item";
|
||||
import "@polymer/paper-listbox/paper-listbox";
|
||||
|
||||
@ -87,7 +88,9 @@ class HuiInputSelectEntityRow extends LitElement implements EntityRow {
|
||||
hasHold: hasAction(this._config!.hold_action),
|
||||
hasDoubleClick: hasAction(this._config!.double_tap_action),
|
||||
})}
|
||||
tabindex="0"
|
||||
tabindex=${ifDefined(
|
||||
hasAction(this._config.tap_action) ? "0" : undefined
|
||||
)}
|
||||
></state-badge>
|
||||
<ha-paper-dropdown-menu
|
||||
.label=${this._config.name || computeStateName(stateObj)}
|
||||
|
Loading…
x
Reference in New Issue
Block a user