diff --git a/src/components/gallery.ts b/src/components/gallery.ts
index e3efc9b8..278dea11 100644
--- a/src/components/gallery.ts
+++ b/src/components/gallery.ts
@@ -164,9 +164,10 @@ export class FrigateCardGalleryCore extends LitElement {
`
: child.thumbnail
? html`
{
if (this.view) {
this.view
diff --git a/src/components/live.ts b/src/components/live.ts
index b09ccc61..21d6f76d 100644
--- a/src/components/live.ts
+++ b/src/components/live.ts
@@ -1,3 +1,4 @@
+// TODO clip autoplay not working as expected
// TODO verify README links worked correctly (e.g. basic cameras configuration)
import {
@@ -388,11 +389,11 @@ export class FrigateCardLiveCarousel extends FrigateCardMediaCarousel {
return html`
) =>
this._mediaShowEventHandler(slideIndex, e)}
>
@@ -470,7 +471,7 @@ export class FrigateCardLiveCarousel extends FrigateCardMediaCarousel {
${ref(this._previousControlRef)}
.direction=${'previous'}
.controlConfig=${config.controls.next_previous}
- .title=${getCameraTitle(this.hass, prev)}
+ .label=${getCameraTitle(this.hass, prev)}
.icon=${getCameraIcon(this.hass, prev)}
?disabled=${prev == null}
@click=${() => {
@@ -485,7 +486,7 @@ export class FrigateCardLiveCarousel extends FrigateCardMediaCarousel {
${ref(this._nextControlRef)}
.direction=${'next'}
.controlConfig=${config.controls.next_previous}
- .title=${getCameraTitle(this.hass, next)}
+ .label=${getCameraTitle(this.hass, next)}
.icon=${getCameraIcon(this.hass, next)}
?disabled=${next == null}
@click=${() => {
@@ -514,6 +515,10 @@ export class FrigateCardLiveProvider extends LitElement {
@property({ attribute: true, type: Boolean })
public disabled = false;
+ // Label that is used for ARIA support and as tooltip.
+ @property({ attribute: false })
+ public label = "";
+
protected _getResolvedProvider(): LiveProvider {
if (this.cameraConfig?.live_provider === 'auto') {
if (this.cameraConfig?.webrtc?.entity || this.cameraConfig?.webrtc?.url) {
@@ -537,6 +542,10 @@ export class FrigateCardLiveProvider extends LitElement {
return;
}
+ // Set title and ariaLabel from the provided label property.
+ this.title = this.label;
+ this.ariaLabel = this.label;
+
const provider = this._getResolvedProvider();
return html`
diff --git a/src/components/menu.ts b/src/components/menu.ts
index 663b88b1..36046859 100644
--- a/src/components/menu.ts
+++ b/src/components/menu.ts
@@ -1,4 +1,4 @@
-import { HomeAssistant, handleAction, hasAction } from 'custom-card-helpers';
+import { HASSDomEvent, HomeAssistant, handleAction, hasAction } from 'custom-card-helpers';
import { CSSResultGroup, LitElement, TemplateResult, html, unsafeCSS } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import { classMap } from 'lit/directives/class-map.js';
@@ -65,7 +65,7 @@ export class FrigateCardMenu extends LitElement {
* @param button The button configuration.
*/
protected _actionHandler(
- ev: CustomEvent<{ action: string; config?: Actions }>,
+ ev: HASSDomEvent<{ action: string; config?: Actions }>,
config?: Actions,
): void {
if (!ev) {
@@ -152,21 +152,15 @@ export class FrigateCardMenu extends LitElement {
button: true,
};
- // TODO: Upon a safe distance from the release of HA 2021.11 these
- // attributes can be removed from the .
- // - icon (replaced with the embedded )
- // - title (replaced with .label)
return html` this._actionHandler(ev, button)}
.actionHandler=${actionHandler({
hasHold: hasHold,
hasDoubleClick: hasDoubleClick,
})}
+ .label=${stateParameters.title || ''}
+ @action=${(ev) => this._actionHandler(ev, button)}
>
`;
diff --git a/src/components/next-prev-control.ts b/src/components/next-prev-control.ts
index 0e973d8c..6c37f651 100644
--- a/src/components/next-prev-control.ts
+++ b/src/components/next-prev-control.ts
@@ -30,6 +30,9 @@ export class FrigateCardNextPreviousControl extends LitElement {
@property({ attribute: true, type: Boolean })
public disabled = false;
+ // Label that is used for ARIA support and as tooltip.
+ @property() label = "";
+
protected render(): TemplateResult {
if (this.disabled || !this._controlConfig || this._controlConfig.style == 'none') {
return html``;
@@ -55,15 +58,9 @@ export class FrigateCardNextPreviousControl extends LitElement {
icon = this.icon
}
- // TODO: Upon a safe distance from the release of HA 2021.11 these
- // attributes can be removed from the .
- // - icon (replaced with the embedded )
- // - title (replaced with .label)
return html`
`;
@@ -75,7 +72,8 @@ export class FrigateCardNextPreviousControl extends LitElement {
return html`
`;
}
diff --git a/src/components/thumbnail-carousel.ts b/src/components/thumbnail-carousel.ts
index 62139d7a..55e327ae 100644
--- a/src/components/thumbnail-carousel.ts
+++ b/src/components/thumbnail-carousel.ts
@@ -25,7 +25,7 @@ export class FrigateCardThumbnailCarousel extends FrigateCardCarousel {
@property({ attribute: false })
set config(config: ThumbnailsControlConfig | undefined) {
if (config) {
- if (config && (config.size !== undefined && config.size !== null)) {
+ if (config && config.size !== undefined && config.size !== null) {
this.style.setProperty('--frigate-card-carousel-thumbnail-size', config.size);
}
this._config = config;
@@ -35,7 +35,10 @@ export class FrigateCardThumbnailCarousel extends FrigateCardCarousel {
@property({ attribute: false })
set highlightSelected(value: boolean) {
- this.style.setProperty('--frigate-card-carousel-thumbnail-opacity', value ? '0.6' : '1.0');
+ this.style.setProperty(
+ '--frigate-card-carousel-thumbnail-opacity',
+ value ? '0.6' : '1.0',
+ );
}
/**
@@ -79,10 +82,7 @@ export class FrigateCardThumbnailCarousel extends FrigateCardCarousel {
const slides: TemplateResult[] = [];
for (let i = 0; i < this.target.children.length; ++i) {
- const thumbnail = this._renderThumbnail(
- this.target,
- i,
- slides.length);
+ const thumbnail = this._renderThumbnail(this.target, i, slides.length);
if (thumbnail) {
slides.push(thumbnail);
}
@@ -121,7 +121,11 @@ export class FrigateCardThumbnailCarousel extends FrigateCardCarousel {
}
}}
>
-
+
`;
}
diff --git a/src/components/viewer.ts b/src/components/viewer.ts
index 799a5d06..47b7e339 100644
--- a/src/components/viewer.ts
+++ b/src/components/viewer.ts
@@ -601,7 +601,7 @@ export class FrigateCardViewerCarousel extends FrigateCardMediaCarousel {
.direction=${'previous'}
.controlConfig=${this.viewerConfig?.controls.next_previous}
.thumbnail=${prev && prev.thumbnail ? prev.thumbnail : undefined}
- .title=${prev ? prev.title : ''}
+ .label=${prev ? prev.title : ''}
?disabled=${!prev}
@click=${() => {
this._nextPreviousHandler('previous');
@@ -615,7 +615,7 @@ export class FrigateCardViewerCarousel extends FrigateCardMediaCarousel {
.direction=${'next'}
.controlConfig=${this.viewerConfig?.controls.next_previous}
.thumbnail=${next && next.thumbnail ? next.thumbnail : undefined}
- .title=${next ? next.title : ''}
+ .label=${next ? next.title : ''}
?disabled=${!next}
@click=${() => {
this._nextPreviousHandler('next');
@@ -657,19 +657,21 @@ export class FrigateCardViewerCarousel extends FrigateCardMediaCarousel {
${this.view.isClipRelatedView()
? html`
) =>
this._mediaShowEventHandler(slideIndex, e)}
>
`
: html`

{
diff --git a/src/patches/ha-camera-stream.ts b/src/patches/ha-camera-stream.ts
index 6aec018a..83408a43 100644
--- a/src/patches/ha-camera-stream.ts
+++ b/src/patches/ha-camera-stream.ts
@@ -48,10 +48,6 @@ customElements.whenDefined('ha-camera-stream').then(() => {
? html`
![]()
{
- // TODO: This block can be removed a safe distance from HA 2021.11.
- if (typeof this._elementResized != 'undefined') {
- this._elementResized();
- }
dispatchMediaShowEvent(this, e);
}}
.src=${typeof this._connected == 'undefined' || this._connected
diff --git a/src/patches/ha-hls-player.ts b/src/patches/ha-hls-player.ts
index 4e8cbce5..85807e74 100644
--- a/src/patches/ha-hls-player.ts
+++ b/src/patches/ha-hls-player.ts
@@ -34,10 +34,6 @@ customElements.whenDefined('ha-hls-player').then(() => {
?playsinline=${this.playsInline}
?controls=${this.controls}
@loadeddata=${(e) => {
- // TODO: This block can be removed a safe distance from HA 2021.11.
- if (typeof this._elementResized != 'undefined') {
- this._elementResized();
- }
dispatchMediaShowEvent(this, e);
}}
@pause=${() => dispatchPauseEvent(this)}