Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make menu's work with keyboard #6421

Merged
merged 1 commit into from
Jul 17, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions hassio/src/addon-store/hassio-addon-store.ts
Expand Up @@ -101,10 +101,10 @@ class HassioAddonStore extends LitElement {
<mwc-icon-button slot="trigger" alt="menu">
<ha-svg-icon path=${mdiDotsVertical}></ha-svg-icon>
</mwc-icon-button>
<mwc-list-item @tap=${this._manageRepositories}>
<mwc-list-item @request-selected=${this._manageRepositories}>
Repositories
</mwc-list-item>
<mwc-list-item @tap=${this.refreshData}>
<mwc-list-item @request-selected=${this.refreshData}>
Reload
</mwc-list-item>
</ha-button-menu>
Expand Down
1 change: 0 additions & 1 deletion src/components/ha-button-menu.ts
Expand Up @@ -10,7 +10,6 @@ import {
} from "lit-element";
import "@material/mwc-button";
import "@material/mwc-menu";
import "@material/mwc-list/mwc-list-item";
import type { Menu, Corner } from "@material/mwc-menu";

import "./ha-icon-button";
Expand Down
2 changes: 1 addition & 1 deletion src/components/ha-date-range-picker.ts
Expand Up @@ -77,7 +77,7 @@ export class HaDateRangePicker extends LitElement {
</div>
${this.ranges
? html`<div slot="ranges" class="date-range-ranges">
<mwc-list @click=${this._setDateRange}>
<mwc-list @request-selected=${this._setDateRange}>
${Object.entries(this.ranges).map(
([name, dates]) => html`<mwc-list-item
.activated=${this.startDate.getTime() ===
Expand Down
Expand Up @@ -136,7 +136,7 @@ export default class HaAutomationActionRow extends LitElement {
><ha-svg-icon path=${mdiDotsVertical}></ha-svg-icon>
</mwc-icon-button>
<mwc-list-item
@tap=${this._switchYamlMode}
@request-selected=${this._switchYamlMode}
.disabled=${selected === -1}
>
${yamlMode
Expand All @@ -152,7 +152,7 @@ export default class HaAutomationActionRow extends LitElement {
"ui.panel.config.automation.editor.actions.duplicate"
)}
</mwc-list-item>
<mwc-list-item @tap=${this._onDelete}>
<mwc-list-item @request-selected=${this._onDelete}>
${this.hass.localize(
"ui.panel.config.automation.editor.actions.delete"
)}
Expand Down
Expand Up @@ -71,7 +71,7 @@ export default class HaAutomationConditionRow extends LitElement {
slot="trigger"
><ha-svg-icon path=${mdiDotsVertical}></ha-svg-icon
></mwc-icon-button>
<mwc-list-item @tap=${this._switchYamlMode}>
<mwc-list-item @request-selected=${this._switchYamlMode}>
${this._yamlMode
? this.hass.localize(
"ui.panel.config.automation.editor.edit_ui"
Expand All @@ -85,7 +85,7 @@ export default class HaAutomationConditionRow extends LitElement {
"ui.panel.config.automation.editor.actions.duplicate"
)}
</mwc-list-item>
<mwc-list-item @tap=${this._onDelete}>
<mwc-list-item @request-selected=${this._onDelete}>
${this.hass.localize(
"ui.panel.config.automation.editor.actions.delete"
)}
Expand Down
Expand Up @@ -101,7 +101,7 @@ export default class HaAutomationTriggerRow extends LitElement {
><ha-svg-icon path=${mdiDotsVertical}></ha-svg-icon
></mwc-icon-button>
<mwc-list-item
@tap=${this._switchYamlMode}
@request-selected=${this._switchYamlMode}
.disabled=${selected === -1}
>
${yamlMode
Expand All @@ -117,7 +117,7 @@ export default class HaAutomationTriggerRow extends LitElement {
"ui.panel.config.automation.editor.actions.duplicate"
)}
</mwc-list-item>
<mwc-list-item @tap=${this._onDelete}>
<mwc-list-item @request-selected=${this._onDelete}>
${this.hass.localize(
"ui.panel.config.automation.editor.actions.delete"
)}
Expand Down
6 changes: 3 additions & 3 deletions src/panels/config/entities/ha-config-entities.ts
Expand Up @@ -462,7 +462,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
<ha-svg-icon path=${mdiFilterVariant}></ha-svg-icon>
</mwc-icon-button>
<mwc-list-item
@click="${this._showDisabledChanged}"
@request-selected="${this._showDisabledChanged}"
graphic="control"
>
<ha-checkbox
Expand All @@ -474,7 +474,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
)}
</mwc-list-item>
<mwc-list-item
@click="${this._showRestoredChanged}"
@request-selected="${this._showRestoredChanged}"
graphic="control"
>
<ha-checkbox
Expand All @@ -486,7 +486,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
)}
</mwc-list-item>
<mwc-list-item
@click="${this._showReadOnlyChanged}"
@request-selected="${this._showReadOnlyChanged}"
graphic="control"
>
<ha-checkbox
Expand Down
2 changes: 1 addition & 1 deletion src/panels/config/integrations/ha-config-integrations.ts
Expand Up @@ -284,7 +284,7 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
>
<ha-svg-icon path=${mdiDotsVertical}></ha-svg-icon>
</mwc-icon-button>
<mwc-list-item @click=${this._toggleShowIgnored}>
<mwc-list-item @request-selected=${this._toggleShowIgnored}>
${this.hass.localize(
this._showIgnored
? "ui.panel.config.integrations.ignore.hide_ignored"
Expand Down
7 changes: 5 additions & 2 deletions src/panels/config/integrations/ha-integration-card.ts
Expand Up @@ -231,7 +231,7 @@ export class HaIntegrationCard extends LitElement {
>
<ha-svg-icon path=${mdiDotsVertical}></ha-svg-icon>
</mwc-icon-button>
<mwc-list-item @click=${this._showSystemOptions}>
<mwc-list-item @request-selected=${this._showSystemOptions}>
${this.hass.localize(
"ui.panel.config.integrations.config_entry.system_options"
)}
Expand All @@ -255,7 +255,10 @@ export class HaIntegrationCard extends LitElement {
</mwc-list-item>
</a>
`}
<mwc-list-item class="warning" @click=${this._removeIntegration}>
<mwc-list-item
class="warning"
@request-selected=${this._removeIntegration}
>
${this.hass.localize(
"ui.panel.config.integrations.config_entry.delete"
)}
Expand Down
9 changes: 6 additions & 3 deletions src/panels/lovelace/components/hui-card-options.ts
Expand Up @@ -78,17 +78,20 @@ export class HuiCardOptions extends LitElement {
<ha-svg-icon path=${mdiDotsVertical}></ha-svg-icon>
</mwc-icon-button>

<mwc-list-item @tap=${this._moveCard}>
<mwc-list-item @request-selected=${this._moveCard}>
${this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.move"
)}</mwc-list-item
>
<mwc-list-item @tap=${this._duplicateCard}
<mwc-list-item @request-selected=${this._duplicateCard}
>${this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.duplicate"
)}</mwc-list-item
>
<mwc-list-item class="delete-item" @tap=${this._deleteCard}>
<mwc-list-item
class="delete-item"
@request-selected=${this._deleteCard}
>
${this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.delete"
)}</mwc-list-item
Expand Down
4 changes: 4 additions & 0 deletions src/panels/lovelace/editor/card-editor/hui-card-editor.ts
Expand Up @@ -302,6 +302,10 @@ export class HuiCardEditor extends LitElement {
.yaml-editor {
padding: 8px 0px;
}
.error,
.warning {
word-break: break-word;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes #6420 right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah

}
.error {
color: var(--error-color);
}
Expand Down
16 changes: 9 additions & 7 deletions src/panels/lovelace/hui-root.ts
Expand Up @@ -160,14 +160,16 @@ class HUIRoot extends LitElement {
aria-label=${this.hass!.localize(
"ui.panel.lovelace.unused_entities.title"
)}
@tap="${this._handleUnusedEntities}"
@request-selected="${this._handleUnusedEntities}"
>
${this.hass!.localize(
"ui.panel.lovelace.unused_entities.title"
)}
</mwc-list-item>
`}
<mwc-list-item @tap="${this.lovelace!.enableFullEditMode}">
<mwc-list-item
@request-selected="${this.lovelace!.enableFullEditMode}"
>
${this.hass!.localize(
"ui.panel.lovelace.editor.menu.raw_editor"
)}
Expand Down Expand Up @@ -210,7 +212,7 @@ class HUIRoot extends LitElement {
aria-label=${this.hass!.localize(
"ui.panel.lovelace.menu.refresh"
)}
@tap="${this._handleRefresh}"
@request-selected="${this._handleRefresh}"
>
${this.hass!.localize(
"ui.panel.lovelace.menu.refresh"
Expand All @@ -220,7 +222,7 @@ class HUIRoot extends LitElement {
aria-label=${this.hass!.localize(
"ui.panel.lovelace.unused_entities.title"
)}
@tap="${this._handleUnusedEntities}"
@request-selected="${this._handleUnusedEntities}"
>
${this.hass!.localize(
"ui.panel.lovelace.unused_entities.title"
Expand All @@ -235,7 +237,7 @@ class HUIRoot extends LitElement {
aria-label=${this.hass!.localize(
"ui.panel.lovelace.menu.reload_resources"
)}
@tap="${this._handleReloadResources}"
@request-selected=${this._handleReloadResources}
>
${this.hass!.localize(
"ui.panel.lovelace.menu.reload_resources"
Expand All @@ -249,7 +251,7 @@ class HUIRoot extends LitElement {
aria-label=${this.hass!.localize(
"ui.panel.lovelace.menu.configure_ui"
)}
@tap="${this._editModeEnable}"
@request-selected=${this._editModeEnable}
>
${this.hass!.localize(
"ui.panel.lovelace.menu.configure_ui"
Expand All @@ -261,7 +263,7 @@ class HUIRoot extends LitElement {
aria-label=${this.hass!.localize(
"ui.panel.lovelace.menu.help"
)}
@tap="${this._handleHelp}"
@request-selected=${this._handleHelp}
>
${this.hass!.localize("ui.panel.lovelace.menu.help")}
</mwc-list-item>
Expand Down
2 changes: 1 addition & 1 deletion src/panels/shopping-list/ha-panel-shopping-list.js
Expand Up @@ -90,7 +90,7 @@ class HaPanelShoppingList extends LocalizeMixin(PolymerElement) {
slot="trigger"
>
</ha-icon-button>
<mwc-list-item on-click="_clearCompleted">
<mwc-list-item on-request-selected="_clearCompleted">
[[localize('ui.panel.shopping-list.clear_completed')]]
</mwc-list-item>
</ha-button-menu>
Expand Down