Add more alternative text to various images (#14932)

* Add alt text for cast launcher images

* Hide icon with supervisor form field label

* Use attribute for iframe title for ingress view

* Hide some decorative ZWave/ZHA icons

* Hide image preload in state card configurator

* Use title for alt text  on image media

* Hide media art as decorative

* Do not allow empty string for image media
This commit is contained in:
Steve Repsher 2023-01-22 22:47:12 -05:00 committed by GitHub
parent c8883a6a8a
commit 1b922e0065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 27 additions and 8 deletions

View File

@ -22,7 +22,11 @@ class HcLayout extends LitElement {
return html`
<ha-card>
<div class="layout">
<img class="hero" src="/images/google-nest-hub.png" />
<img
class="hero"
alt="A Google Nest Hub with a Home Assistant dashboard on its screen"
src="/images/google-nest-hub.png"
/>
<h1 class="card-header">
Home Assistant Cast${this.subtitle ? ` ${this.subtitle}` : ""}
${this.auth

View File

@ -12,6 +12,7 @@ class HcLaunchScreen extends LitElement {
return html`
<div class="container">
<img
alt="Home Assistant logo on left, Nabu Casa logo on right, and red heart in center"
src="https://www.home-assistant.io/images/blog/2018-09-thinking-big/social.png"
/>
<div class="status">

View File

@ -15,7 +15,7 @@ class SupervisorFormfieldLabel extends LitElement {
protected render(): TemplateResult {
return html`
${this.imageUrl
? html`<img loading="lazy" .src=${this.imageUrl} class="icon" />`
? html`<img loading="lazy" alt="" src=${this.imageUrl} class="icon" />`
: this.iconPath
? html`<ha-svg-icon .path=${this.iconPath} class="icon"></ha-svg-icon>`
: ""}

View File

@ -60,8 +60,8 @@ class HassioIngressView extends LitElement {
}
const iframe = html`<iframe
.title=${this._addon.name}
.src=${this._addon.ingress_url!}
title=${this._addon.name}
src=${this._addon.ingress_url!}
>
</iframe>`;

View File

@ -92,6 +92,7 @@ class HaDomainIntegrations extends LitElement {
<img
slot="graphic"
loading="lazy"
alt=""
src=${brandsUrl({
domain,
type: "icon",
@ -153,6 +154,7 @@ class HaDomainIntegrations extends LitElement {
<img
slot="graphic"
loading="lazy"
alt=""
src=${brandsUrl({
domain: this.domain,
type: "icon",

View File

@ -227,7 +227,9 @@ export class BarMediaPlayer extends SubscribeMixin(LitElement) {
})}
@click=${this._openMoreInfo}
>
${mediaArt ? html`<img src=${this.hass.hassUrl(mediaArt)} />` : ""}
${mediaArt
? html`<img alt="" src=${this.hass.hassUrl(mediaArt)} />`
: ""}
<div class="media-info">
<hui-marquee
.text=${mediaTitleClean ||

View File

@ -1,4 +1,11 @@
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import {
css,
CSSResultGroup,
html,
LitElement,
nothing,
TemplateResult,
} from "lit";
import { customElement, property } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import { createCloseHeading } from "../../components/ha-dialog";
@ -76,7 +83,10 @@ export class HuiDialogWebBrowserPlayMedia extends LitElement {
></ha-hls-player>
`
: mediaType === "image"
? html`<img src=${this._params.sourceUrl} />`
? html`<img
alt=${this._params.title || nothing}
src=${this._params.sourceUrl}
/>`
: html`${this.hass.localize(
"ui.components.media-browser.media_not_supported"
)}`}

View File

@ -31,7 +31,7 @@ class StateCardConfigurator extends LocalizeMixin(PolymerElement) {
<!-- pre load the image so the dialog is rendered the proper size -->
<template is="dom-if" if="[[stateObj.attributes.description_image]]">
<img hidden="" src="[[stateObj.attributes.description_image]]" />
<img hidden="" alt="" src="[[stateObj.attributes.description_image]]" />
</template>
`;
}