Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/panels/lovelace/badges/hui-state-label-badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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>
`;
}
Expand Down
5 changes: 4 additions & 1 deletion src/panels/lovelace/cards/hui-entity-button-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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`
Expand Down
5 changes: 4 additions & 1 deletion src/panels/lovelace/cards/hui-glance-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion src/panels/lovelace/cards/hui-picture-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
CSSResult,
PropertyValues,
} from "lit-element";
import { ifDefined } from "lit-html/directives/if-defined";

import "../../../components/ha-card";

Expand All @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion src/panels/lovelace/cards/hui-picture-entity-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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,
})}
Expand Down
9 changes: 7 additions & 2 deletions src/panels/lovelace/cards/hui-picture-glance-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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),
Expand Down
5 changes: 4 additions & 1 deletion src/panels/lovelace/components/hui-generic-entity-row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/panels/lovelace/elements/hui-icon-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
CSSResult,
customElement,
} from "lit-element";
import { ifDefined } from "lit-html/directives/if-defined";

import "../../../components/ha-icon";

Expand Down Expand Up @@ -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>
`;
}
Expand Down
5 changes: 4 additions & 1 deletion src/panels/lovelace/elements/hui-image-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
css,
CSSResult,
} from "lit-element";
import { ifDefined } from "lit-html/directives/if-defined";

import "../components/hui-image";

Expand Down Expand Up @@ -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>
`;
}
Expand Down
5 changes: 4 additions & 1 deletion src/panels/lovelace/elements/hui-state-badge-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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>
`;
}
Expand Down
5 changes: 4 additions & 1 deletion src/panels/lovelace/elements/hui-state-icon-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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>
`;
Expand Down
5 changes: 4 additions & 1 deletion src/panels/lovelace/elements/hui-state-label-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
CSSResult,
PropertyValues,
} from "lit-element";
import { ifDefined } from "lit-html/directives/if-defined";

import "../components/hui-warning-element";

Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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)}
Expand Down