Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f527c8c
ha-config-area-page: Add alt tag for area-picture
transplier Nov 18, 2022
c4816f1
dialog-tag-detail: Add alt tag for generated QR code image.
transplier Nov 18, 2022
0175151
ha-config-hardware: Blank alt tag for hardware pic, info already else…
transplier Nov 18, 2022
096c241
dialog-energy-solar-settings: Blank alt tag for brand icon.
transplier Nov 18, 2022
8fe30b9
ha-energy-grid-settings: Blank alt tag for co2signal brand icon.
transplier Nov 18, 2022
3b16629
Add a few more appropriately-blank alt texts.
transplier Nov 18, 2022
1bae40f
ha-config-device-page: Logo alt text set to name of device domain.
transplier Nov 18, 2022
cc1d7f8
ha-config-repairs: Logo alt text set to name of issue domain.
transplier Nov 18, 2022
81da894
hui-picture-card(-editor): Alternate Text via config (blank default)
transplier Nov 18, 2022
175be84
hui-picture-entity-card(-editor): Alternate Text via config (blank de…
transplier Nov 18, 2022
4cc7278
ha-long-lived-access-token-dialog: Alt text for QR code.
transplier Nov 18, 2022
bec8b78
hui-picture-header-footer: Support alt text via optional property.
transplier Nov 18, 2022
3527a08
A few more blank alt attributes.
transplier Nov 18, 2022
95cb501
ha-tile-image: Support alt tag (but it is blank in current usage).
transplier Nov 18, 2022
fd622e4
prod cla-bot
transplier Nov 18, 2022
60a7073
Lint. Fix whitespace.
transplier Nov 18, 2022
056d325
Add missing alt text properties to TS types.
transplier Nov 18, 2022
0a01244
Fix my silly typo in picture-entity-card-editor's SCHEMA (+ minor ref…
transplier Nov 18, 2022
86c94f7
Add alt_text to Picture(Entity)CardConfig TypeScript types.
transplier Nov 18, 2022
b4ad698
Format with prettier.
transplier Nov 18, 2022
09c2ddf
Revise alt text for tag QR
steverep Dec 13, 2022
33dcab3
Revise alt text for token QR
steverep Dec 13, 2022
c32c835
Revise alternate to alternative
steverep Dec 13, 2022
6e706c6
Add alt to logo in gallery
steverep Dec 13, 2022
23b6959
Add alt text to crop image
steverep Dec 14, 2022
a6109a9
Use ifDefined for tile image alt
steverep Dec 14, 2022
92906ff
Change area picture alt to area name
steverep Dec 22, 2022
1624084
Remove entry from entities config struct
steverep Dec 22, 2022
d43619e
Revert altText changes for Picture Entity Card (to revisit in future PR)
transplier Dec 23, 2022
1a6e84f
Revert changes to hui-image and picture entity editor
steverep Dec 29, 2022
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
4 changes: 3 additions & 1 deletion gallery/src/pages/components/ha-alert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ const alerts: {
description: "Alert with slotted image",
type: "warning",
iconSlot: html`<span slot="icon" class="image"
><img src="https://www.home-assistant.io/images/home-assistant-logo.svg"
><img
alt="Home Assistant logo"
Comment thread
steverep marked this conversation as resolved.
src="https://www.home-assistant.io/images/home-assistant-logo.svg"
/></span>`,
},
{
Expand Down
1 change: 1 addition & 0 deletions hassio/src/addon-view/info/hassio-addon-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ class HassioAddonInfo extends LitElement {
? html`
<img
class="logo"
alt=""
Comment thread
steverep marked this conversation as resolved.
src="/api/hassio/addons/${this.addon.slug}/logo"
/>
`
Expand Down
6 changes: 5 additions & 1 deletion src/components/ha-addon-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ const rowRenderer: ComboBoxLitRenderer<HassioAddonInfo> = (
<span>${item.name}</span>
<span slot="secondary">${item.slug}</span>
${item.icon
? html`<img slot="graphic" .src="/api/hassio/addons/${item.slug}/icon" />`
? html`<img
alt=""
slot="graphic"
.src="/api/hassio/addons/${item.slug}/icon"
/>`
: ""}
</mwc-list-item>`;

Expand Down
1 change: 1 addition & 0 deletions src/components/ha-config-entry-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class HaConfigEntryPicker extends LitElement {
>
<span slot="secondary">${item.localized_domain_name}</span>
<img
alt=""
Comment thread
steverep marked this conversation as resolved.
slot="graphic"
src=${brandsUrl({
domain: item.domain,
Expand Down
7 changes: 6 additions & 1 deletion src/components/tile/ha-tile-image.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { CSSResultGroup, html, css, LitElement, TemplateResult } from "lit";
import { customElement, property } from "lit/decorators";
import { ifDefined } from "lit/directives/if-defined";

@customElement("ha-tile-image")
export class HaTileImage extends LitElement {
@property() public imageUrl?: string;

@property() public imageAlt?: string;

protected render(): TemplateResult {
return html`
<div class="image">
${this.imageUrl ? html`<img src=${this.imageUrl} />` : null}
${this.imageUrl
? html`<img alt=${ifDefined(this.imageAlt)} src=${this.imageUrl} />`
: null}
</div>
`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/dialogs/image-cropper-dialog/image-cropper-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class HaImagecropperDialog extends LitElement {
round: Boolean(this._params?.options.round),
})}"
>
<img />
<img alt=${this.hass.localize("ui.dialogs.image_cropper.crop_image")} />
Comment thread
steverep marked this conversation as resolved.
</div>
<mwc-button slot="secondaryAction" @click=${this.closeDialog}>
${this.hass.localize("ui.common.cancel")}
Expand Down
1 change: 1 addition & 0 deletions src/onboarding/integration-badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class IntegrationBadge extends LitElement {
return html`
<div class="icon">
<img
alt=""
Comment thread
steverep marked this conversation as resolved.
src=${brandsUrl({
domain: this.domain,
type: "icon",
Expand Down
3 changes: 2 additions & 1 deletion src/panels/config/areas/ha-config-area-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ class HaConfigAreaPage extends SubscribeMixin(LitElement) {
<div class="column">
${area.picture
? html`<div class="img-container">
<img src=${area.picture} /><ha-icon-button
<img alt=${area.name} src=${area.picture} />
<ha-icon-button
.path=${mdiPencil}
.entry=${area}
@click=${this._showSettings}
Expand Down
4 changes: 4 additions & 0 deletions src/panels/config/devices/ha-config-device-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,10 @@ export class HaConfigDevicePage extends LitElement {
integrations.length
? html`
<img
alt=${domainToName(
Comment thread
steverep marked this conversation as resolved.
this.hass.localize,
integrations[0].domain
)}
src=${brandsUrl({
domain: integrations[0].domain,
type: "logo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ export class EnergyGridSettings extends LitElement {
${this._co2ConfigEntry
? html`<div class="row" .entry=${this._co2ConfigEntry}>
<img
alt=""
Comment thread
steverep marked this conversation as resolved.
referrerpolicy="no-referrer"
src=${brandsUrl({
domain: "co2signal",
Expand All @@ -244,6 +245,7 @@ export class EnergyGridSettings extends LitElement {
: html`
<div class="row border-bottom">
<img
alt=""
Comment thread
steverep marked this conversation as resolved.
referrerpolicy="no-referrer"
src=${brandsUrl({
domain: "co2signal",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export class DialogEnergySolarSettings
style="display: flex; align-items: center;"
>
<img
alt=""
Comment thread
steverep marked this conversation as resolved.
referrerpolicy="no-referrer"
style="height: 24px; margin-right: 16px;"
src=${brandsUrl({
Expand Down
2 changes: 1 addition & 1 deletion src/panels/config/hardware/ha-config-hardware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
.twoline=${Boolean(boardId)}
>
${imageURL
? html`<img slot="graphic" src=${imageURL} />`
? html`<img alt="" slot="graphic" src=${imageURL} />`
Comment thread
steverep marked this conversation as resolved.
: ""}
<span class="primary-text">
${boardName ||
Expand Down
1 change: 1 addition & 0 deletions src/panels/config/integrations/ha-domain-integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class HaDomainIntegrations extends LitElement {
hasMeta
>
<img
alt=""
Comment thread
steverep marked this conversation as resolved.
slot="graphic"
loading="lazy"
src=${brandsUrl({
Expand Down
1 change: 1 addition & 0 deletions src/panels/config/integrations/ha-integration-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export class HaIntegrationHeader extends LitElement {
<slot name="above-header"></slot>
<div class="header">
<img
alt=""
Comment thread
steverep marked this conversation as resolved.
src=${brandsUrl({
domain: this.domain,
type: "icon",
Expand Down
1 change: 1 addition & 0 deletions src/panels/config/integrations/ha-integration-list-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class HaIntegrationListItem extends ListItemBase {
)}"
>
<img
alt=""
Comment thread
steverep marked this conversation as resolved.
loading="lazy"
src=${brandsUrl({
domain: this.integration.domain,
Expand Down
1 change: 1 addition & 0 deletions src/panels/config/repairs/ha-config-repairs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class HaConfigRepairs extends LitElement {
@click=${this._openShowMoreDialog}
>
<img
alt=${domainToName(this.hass.localize, issue.domain)}
Comment thread
steverep marked this conversation as resolved.
loading="lazy"
src=${brandsUrl({
domain: issue.issue_domain || issue.domain,
Expand Down
1 change: 1 addition & 0 deletions src/panels/config/repairs/integrations-startup-time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class IntegrationsStartupTime extends LitElement {
href=${docLink}
>
<img
alt=""
Comment thread
steverep marked this conversation as resolved.
loading="lazy"
src=${brandsUrl({
domain: setup.domain,
Expand Down
9 changes: 8 additions & 1 deletion src/panels/config/tags/dialog-tag-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,14 @@ class DialogTagDetail
canvas.height / 3
);

this._qrCode = html`<img src=${canvas.toDataURL()}></img>`;
this._qrCode = html`<img
alt=${this.hass.localize(
"ui.panel.config.tag.qr_code_image",
Comment thread
steverep marked this conversation as resolved.
"name",
this._name
)}
src=${canvas.toDataURL()}
></img>`;
}

static get styles(): CSSResultGroup {
Expand Down
5 changes: 4 additions & 1 deletion src/panels/lovelace/cards/hui-picture-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ export class HuiPictureCard extends LitElement implements LovelaceCard {
),
})}
>
<img src=${this.hass.hassUrl(this._config.image)} />
<img
alt=${this._config.alt_text}
src=${this.hass.hassUrl(this._config.image)}
/>
</ha-card>
`;
}
Expand Down
1 change: 1 addition & 0 deletions src/panels/lovelace/cards/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ export interface PictureCardConfig extends LovelaceCardConfig {
hold_action?: ActionConfig;
double_tap_action?: ActionConfig;
theme?: string;
alt_text?: string;
Comment thread
steverep marked this conversation as resolved.
}

export interface PictureElementsCardConfig extends LovelaceCardConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const cardConfigStruct = assign(
tap_action: optional(actionConfigStruct),
hold_action: optional(actionConfigStruct),
theme: optional(string()),
alt_text: optional(string()),
})
);

Expand Down Expand Up @@ -53,6 +54,10 @@ export class HuiPictureCardEditor
return this._config!.theme || "";
}

get _alt_text(): string {
return this._config!.alt_text || "";
}

protected render(): TemplateResult {
if (!this.hass || !this._config) {
return html``;
Expand All @@ -72,6 +77,16 @@ export class HuiPictureCardEditor
.configValue=${"image"}
@input=${this._valueChanged}
></ha-textfield>
<ha-textfield
.label="${this.hass.localize(
"ui.panel.lovelace.editor.card.generic.alt_text"
)} (${this.hass.localize(
"ui.panel.lovelace.editor.card.config.optional"
)})"
.value=${this._alt_text}
.configValue=${"alt_text"}
@input=${this._valueChanged}
></ha-textfield>
<ha-theme-picker
.hass=${this.hass}
.value=${this._theme}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class HuiPictureHeaderFooter

return html`
<img
alt=${this._config!.alt_text}
@action=${this._handleAction}
.actionHandler=${actionHandler({
hasHold: hasAction(this._config!.hold_action),
Expand Down
1 change: 1 addition & 0 deletions src/panels/lovelace/header-footer/structs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const pictureHeaderFooterConfigStruct = object({
tap_action: optional(actionConfigStruct),
hold_action: optional(actionConfigStruct),
double_tap_action: optional(actionConfigStruct),
alt_text: optional(string()),
});

export const buttonsHeaderFooterConfigStruct = object({
Expand Down
1 change: 1 addition & 0 deletions src/panels/lovelace/header-footer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ export interface PictureHeaderFooterConfig extends LovelaceHeaderFooterConfig {
tap_action?: ActionConfig;
hold_action?: ActionConfig;
double_tap_action?: ActionConfig;
alt_text?: string;
}
9 changes: 8 additions & 1 deletion src/panels/profile/ha-long-lived-access-token-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ export class HaLongLivedAccessTokenDialog extends LitElement {
canvas.height / 3
);

this._qrCode = html`<img src=${canvas.toDataURL()}></img>`;
this._qrCode = html`<img
alt=${this.hass.localize(
"ui.panel.profile.long_lived_access_tokens.qr_code_image",
Comment thread
steverep marked this conversation as resolved.
"name",
this._params!.name
)}
src=${canvas.toDataURL()}
></img>`;
}

static get styles(): CSSResultGroup {
Expand Down
8 changes: 6 additions & 2 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,8 @@
"close": "Close"
},
"image_cropper": {
"crop": "Crop"
"crop": "Crop",
"crop_image": "Picture to crop"
},
"more_info_control": {
"dismiss": "Dismiss dialog",
Expand Down Expand Up @@ -1373,6 +1374,7 @@
"confirm_remove_title": "Remove tag?",
"confirm_remove": "Are you sure you want to remove tag {tag}?",
"automation_title": "Tag {name} is scanned",
"qr_code_image": "QR code for tag {name}",
"headers": {
"icon": "Icon",
"name": "Name",
Expand Down Expand Up @@ -4117,6 +4119,7 @@
"description": "The Light card allows you to change the brightness of the light."
},
"generic": {
"alt_text": "Alternative Text",
"aspect_ratio": "Aspect Ratio",
"attribute": "Attribute",
"camera_image": "Camera Entity",
Expand Down Expand Up @@ -4459,7 +4462,8 @@
"name": "Name",
"prompt_name": "Give the token a name",
"prompt_copy_token": "Copy your access token. It will not be shown again.",
"empty_state": "You have no long-lived access tokens yet."
"empty_state": "You have no long-lived access tokens yet.",
"qr_code_image": "QR code for token {name}"
}
},
"shopping_list": {
Expand Down