Add more aria labels (#4293)

* Add aria labels

* Fix polymer binding
This commit is contained in:
Bram Kragten 2019-12-02 09:29:02 +01:00 committed by GitHub
parent e7e9e2cf85
commit caa604d5ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 6 deletions

View File

@ -16,13 +16,14 @@ import { computeStateDomain } from "../../common/entity/compute_state_domain";
import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { isComponentLoaded } from "../../common/config/is_component_loaded";
import { DOMAINS_MORE_INFO_NO_HISTORY } from "../../common/const"; import { DOMAINS_MORE_INFO_NO_HISTORY } from "../../common/const";
import { EventsMixin } from "../../mixins/events-mixin"; import { EventsMixin } from "../../mixins/events-mixin";
import LocalizeMixin from "../../mixins/localize-mixin";
import { computeRTL } from "../../common/util/compute_rtl"; import { computeRTL } from "../../common/util/compute_rtl";
const DOMAINS_NO_INFO = ["camera", "configurator", "history_graph"]; const DOMAINS_NO_INFO = ["camera", "configurator", "history_graph"];
/* /*
* @appliesMixin EventsMixin * @appliesMixin EventsMixin
*/ */
class MoreInfoControls extends EventsMixin(PolymerElement) { class MoreInfoControls extends LocalizeMixin(EventsMixin(PolymerElement)) {
static get template() { static get template() {
return html` return html`
<style include="ha-style-dialog"> <style include="ha-style-dialog">
@ -68,7 +69,7 @@ class MoreInfoControls extends EventsMixin(PolymerElement) {
<app-toolbar> <app-toolbar>
<paper-icon-button <paper-icon-button
aria-label="Dismiss dialog" aria-label$="[[localize('ui.dialogs.more_info_control.dismiss')]]"
icon="hass:close" icon="hass:close"
dialog-dismiss dialog-dismiss
></paper-icon-button> ></paper-icon-button>
@ -77,6 +78,7 @@ class MoreInfoControls extends EventsMixin(PolymerElement) {
</div> </div>
<template is="dom-if" if="[[canConfigure]]"> <template is="dom-if" if="[[canConfigure]]">
<paper-icon-button <paper-icon-button
aria-label$="[[localize('ui.dialogs.more_info_control.settings')]]"
icon="hass:settings" icon="hass:settings"
on-click="_gotoSettings" on-click="_gotoSettings"
></paper-icon-button> ></paper-icon-button>

View File

@ -47,6 +47,7 @@ class MoreInfoSettings extends LocalizeMixin(EventsMixin(PolymerElement)) {
<app-toolbar> <app-toolbar>
<ha-paper-icon-button-arrow-prev <ha-paper-icon-button-arrow-prev
aria-label$="[[localize('ui.dialogs.more_info_settings.back')]]"
on-click="_backTapped" on-click="_backTapped"
></ha-paper-icon-button-arrow-prev> ></ha-paper-icon-button-arrow-prev>
<div main-title="">[[_computeStateName(stateObj)]]</div> <div main-title="">[[_computeStateName(stateObj)]]</div>

View File

@ -49,10 +49,10 @@ export class HuiNotificationDrawer extends EventsMixin(
text-align: center; text-align: center;
} }
</style> </style>
<app-drawer id='drawer' opened="{{open}}" disable-swipe align="start"> <app-drawer id="drawer" opened="{{open}}" disable-swipe align="start">
<app-toolbar> <app-toolbar>
<div main-title>[[localize('ui.notification_drawer.title')]]</div> <div main-title>[[localize('ui.notification_drawer.title')]]</div>
<ha-paper-icon-button-prev on-click="_closeDrawer"></paper-icon-button> <ha-paper-icon-button-prev on-click="_closeDrawer" aria-label$="[[localize('ui.notification_drawer.close')]]"></paper-icon-button>
</app-toolbar> </app-toolbar>
<div class="notifications"> <div class="notifications">
<template is="dom-if" if="[[!_empty(notifications)]]"> <template is="dom-if" if="[[!_empty(notifications)]]">

View File

@ -133,7 +133,11 @@ export class HaConfigManagerDashboard extends LitElement {
)} )}
</div> </div>
</paper-item-body> </paper-item-body>
<ha-icon-next></ha-icon-next> <ha-icon-next
aria-label=${this.hass.localize(
"ui.panel.config.integrations.details"
)}
></ha-icon-next>
</paper-item> </paper-item>
</a> </a>
` `
@ -154,6 +158,7 @@ export class HaConfigManagerDashboard extends LitElement {
<ha-fab <ha-fab
icon="hass:plus" icon="hass:plus"
aria-label=${this.hass.localize("ui.panel.config.integrations.new")}
title=${this.hass.localize("ui.panel.config.integrations.new")} title=${this.hass.localize("ui.panel.config.integrations.new")}
@click=${this._createFlow} @click=${this._createFlow}
?rtl=${computeRTL(this.hass!)} ?rtl=${computeRTL(this.hass!)}

View File

@ -93,6 +93,9 @@ class HUIRoot extends LitElement {
? html` ? html`
<app-toolbar class="edit-mode"> <app-toolbar class="edit-mode">
<paper-icon-button <paper-icon-button
aria-label="${this.hass!.localize(
"ui.panel.lovelace.menu.exit_edit_mode"
)}"
title="${this.hass!.localize( title="${this.hass!.localize(
"ui.panel.lovelace.menu.close" "ui.panel.lovelace.menu.close"
)}" )}"
@ -103,6 +106,9 @@ class HUIRoot extends LitElement {
${this.config.title || ${this.config.title ||
this.hass!.localize("ui.panel.lovelace.editor.header")} this.hass!.localize("ui.panel.lovelace.editor.header")}
<paper-icon-button <paper-icon-button
aria-label="${this.hass!.localize(
"ui.panel.lovelace.editor.edit_lovelace.edit_title"
)}"
title="${this.hass!.localize( title="${this.hass!.localize(
"ui.panel.lovelace.editor.edit_lovelace.edit_title" "ui.panel.lovelace.editor.edit_lovelace.edit_title"
)}" )}"
@ -182,6 +188,12 @@ class HUIRoot extends LitElement {
horizontal-offset="-5" horizontal-offset="-5"
> >
<paper-icon-button <paper-icon-button
aria-label=${this.hass!.localize(
"ui.panel.lovelace.editor.menu.open"
)}
title="${this.hass!.localize(
"ui.panel.lovelace.editor.menu.open"
)}"
icon="hass:dots-vertical" icon="hass:dots-vertical"
slot="dropdown-trigger" slot="dropdown-trigger"
></paper-icon-button> ></paper-icon-button>

View File

@ -569,6 +569,8 @@
"title": "Are you sure?" "title": "Are you sure?"
}, },
"more_info_control": { "more_info_control": {
"dismiss": "Dismiss dialog",
"settings": "Entity settings",
"script": { "script": {
"last_action": "Last Action" "last_action": "Last Action"
}, },
@ -582,6 +584,7 @@
} }
}, },
"more_info_settings": { "more_info_settings": {
"back": "Go back",
"save": "Save", "save": "Save",
"name": "Name Override", "name": "Name Override",
"entity_id": "Entity ID" "entity_id": "Entity ID"
@ -641,7 +644,8 @@
"notification_drawer": { "notification_drawer": {
"click_to_configure": "Click button to configure {entity}", "click_to_configure": "Click button to configure {entity}",
"empty": "No Notifications", "empty": "No Notifications",
"title": "Notifications" "title": "Notifications",
"close": "Close"
}, },
"notification_toast": { "notification_toast": {
"service_call_failed": "Failed to call service {service}.", "service_call_failed": "Failed to call service {service}.",
@ -1299,6 +1303,7 @@
"configure": "Configure", "configure": "Configure",
"none": "Nothing configured yet", "none": "Nothing configured yet",
"integration_not_found": "Integration not found.", "integration_not_found": "Integration not found.",
"details": "Integration details",
"config_entry": { "config_entry": {
"settings_button": "Edit settings for {integration}", "settings_button": "Edit settings for {integration}",
"system_options_button": "System options for {integration}", "system_options_button": "System options for {integration}",
@ -1518,6 +1523,7 @@
"configure_ui": "Configure UI", "configure_ui": "Configure UI",
"help": "Help", "help": "Help",
"refresh": "Refresh", "refresh": "Refresh",
"exit_edit_mode": "Exit UI edit mode",
"close": "Close" "close": "Close"
}, },
"editor": { "editor": {