From 7d415394cdf0c8f01627fc43a18fae7857bf36f9 Mon Sep 17 00:00:00 2001 From: Elizabeth Mitchell Date: Thu, 10 Aug 2023 16:44:40 -0700 Subject: [PATCH] chore(dialog): fix demo a11y PiperOrigin-RevId: 555706529 --- dialog/demo/stories.ts | 74 ++++++++++++++++++++++++++------------- dialog/internal/dialog.ts | 2 +- 2 files changed, 50 insertions(+), 26 deletions(-) diff --git a/dialog/demo/stories.ts b/dialog/demo/stories.ts index 07b1edfaa2..598947f2b9 100644 --- a/dialog/demo/stories.ts +++ b/dialog/demo/stories.ts @@ -24,17 +24,18 @@ export interface StoryKnobs { supportingText: string; } -function clickHandler(event: Event) { +function showDialog(event: Event) { ((event.target as Element).nextElementSibling as MdDialog)?.show(); } - const standard: MaterialStoryInit = { - name: 'Standard', + name: 'Dialog', render({icon, headline, supportingText}) { return html` - Open - + Open + + ${icon ? html`${icon}` : nothing}
${headline}
@@ -53,7 +54,9 @@ const alert: MaterialStoryInit = { name: 'Alert', render() { return html` - Open + Alert +
Alert dialog
@@ -72,16 +75,20 @@ const confirm: MaterialStoryInit = { name: 'Confirm', render() { return html` - Open + Confirm +
Permanently delete?
delete_outline - Deleting the selected photos will also remove them from all synced devices. + Deleting the selected photos will also remove them from all synced + devices.
Delete - Cancel + Cancel
`; @@ -93,23 +100,29 @@ const choose: MaterialStoryInit = { styles: css` label { display: flex; - gap: 8px; align-items: center; } - `, + `, render() { return html` - Open + Choice +
Choose your favorite pet
-
- This is a standard choice dialog. These dialogs give users the ability to make - a decision and confirm it. This gives them a chance to change their minds if necessary. -
- - - + + +
Cancel @@ -121,7 +134,7 @@ const choose: MaterialStoryInit = { }; const contacts: MaterialStoryInit = { - name: 'Contacts', + name: 'Form', styles: css` .contacts { min-width: calc(100vw - 212px); @@ -148,13 +161,16 @@ const contacts: MaterialStoryInit = { .contact-row > * { flex: 1; - }`, + } + `, render() { return html` - Open + Form + - + close Create new contact @@ -172,6 +188,8 @@ const contacts: MaterialStoryInit = {
+ Reset +
Cancel Save
@@ -184,11 +202,17 @@ const floatingSheet: MaterialStoryInit = { name: 'Floating sheet', render() { return html` - Open + + Floating sheet + + Floating Sheet - + close diff --git a/dialog/internal/dialog.ts b/dialog/internal/dialog.ts index a9be7ab39b..caf3c6abd9 100644 --- a/dialog/internal/dialog.ts +++ b/dialog/internal/dialog.ts @@ -209,7 +209,7 @@ export class Dialog extends LitElement { @click=${this.handleContentClick} >
-
+