From 44beacb21d86c7b6e5c7f91eb34d555d08d7ecff Mon Sep 17 00:00:00 2001 From: Elliott Marquez Date: Mon, 14 Oct 2019 16:13:32 -0700 Subject: [PATCH 1/4] dialog title -> heading --- demos/dialog.html | 18 +++++++++--------- packages/dialog/README.md | 16 ++++++++-------- packages/dialog/src/mwc-dialog-base.ts | 12 ++++++------ packages/dialog/src/mwc-dialog.scss | 2 +- packages/dialog/src/test/mwc-dialog.test.ts | 2 +- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/demos/dialog.html b/demos/dialog.html index a10aba0f1..1776aa6c1 100644 --- a/demos/dialog.html +++ b/demos/dialog.html @@ -44,14 +44,14 @@ limitations under the License.
Basic - + Dialog body text Action 2 Action 1 Actions - +

By setting the dialogAction="my-action" attribute on any element projected into mwc-dialog, you can close the dialog by clicking on that element. The @@ -63,7 +63,7 @@ limitations under the License. Scrollable - +

Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really long text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll. Really log text will scroll.

@@ -71,7 +71,7 @@ limitations under the License.
Hide Actions - +

If you don't have actions, you may want to set the "hideActions" property. This property will remove extra whitespace at the bottom of this dialog. @@ -90,7 +90,7 @@ limitations under the License. .styled { --mdc-theme-surface: #FFF; --mdc-dialog-scrim-color: rgba(35, 47, 52, .32); - --mdc-dialog-title-ink-color: #232F34; + --mdc-dialog-heading-ink-color: #232F34; --mdc-dialog-content-ink-color: #232F34; --mdc-dialog-scroll-divider-color: transparent; --mdc-dialog-min-width: 500px; @@ -104,12 +104,12 @@ limitations under the License. Styled - +

These are the current styles applied to this dialog
 --mdc-theme-surface: #FFF;
 --mdc-dialog-scrim-color: rgba(35, 47, 52, .32);
---mdc-dialog-title-ink-color: #232F34;
+--mdc-dialog-heading-ink-color: #232F34;
 --mdc-dialog-content-ink-color: #232F34;
 --mdc-dialog-scroll-divider-color: transparent;
 --mdc-dialog-min-width: 500px;
@@ -126,7 +126,7 @@ limitations under the License.
     
 
     Stacked
-    
+    
       
This is what happens when you set the stacked property on mwc-dialog. Notice that the primary action is now on top. @@ -140,7 +140,7 @@ limitations under the License. Initial Focus - +
In this example we set "dialogInitialFocus" on the mwc-textfield. When this dialog opens, it is auto-focused. diff --git a/packages/dialog/README.md b/packages/dialog/README.md index b920d5d08..4fd2b4ee4 100644 --- a/packages/dialog/README.md +++ b/packages/dialog/README.md @@ -33,7 +33,7 @@ npm install @material/mwc-dialog ```html
    @@ -103,7 +103,7 @@ npm install @material/mwc-dialog } - +
    @@ -140,7 +140,7 @@ npm install @material/mwc-dialog ```html - +
    really large amount of text...
    @@ -172,7 +172,7 @@ npm install @material/mwc-dialog } - +
    In this dialog we have changed the button color and removed the border radius. @@ -188,7 +188,7 @@ npm install @material/mwc-dialog ```html - +
    This is what happens when you set the stacked property on mwc-dialog. Notice that the primary action is now on top. @@ -219,7 +219,7 @@ npm install @material/mwc-dialog | `open` | `boolean` | Whether the dialog should open. | `hideActions` | `boolean` | Hides the actions footer of the dialog. Needed to remove excess padding when no actions are slotted in. | `stacked` | `boolean` | Whether to stack the action buttons. -| `title` | `string` | Title of the dialog. +| `heading` | `string` | Heading text of the dialog. | `scrimClickAction` | `string` | _Default: 'close'_ – Action to be emitted with the `closing` and `closed` events when the dialog closes because the scrim was clicked (see [actions section](#actions)). | `escapeKeyAction` | `string` | _Default: 'close'_ – Action to be emitted with the `closing` and `closed` events when the dialog closes because the excape key was pressed (see [actions section](#actions)). | `defaultAction` | `string` | _Default: 'close'_ – Action to be emitted with the `closing` and `closed` events when `.open` is toggled (see [actions section](#actions)). @@ -258,7 +258,7 @@ npm install @material/mwc-dialog | ----------------------------------- | --------------------- |------------ | `--mdc-theme-surface` | ![](images/color_fff.png) `#fff` | Color of the dialog surface's background. | `--mdc-dialog-scrim-color` | ![](images/color_0,0,0,32.png) `rgba(0, 0, 0, 0.32)` | Color of the scrim. (**Note:** setting alpha to 0 will still make scrim clickable but transparent). -| `--mdc-dialog-title-ink-color` | ![](images/color_0,0,0,87.png) `rgba(0, 0, 0, 0.87)` | Color of the title text. +| `--mdc-dialog-heading-ink-color` | ![](images/color_0,0,0,87.png) `rgba(0, 0, 0, 0.87)` | Color of the heading text. | `--mdc-dialog-content-ink-color` | ![](images/color_0,0,0,6.png) `rgba(0, 0, 0, 0.6)` | Color applied to the projected content. (**Note:** it may also be possible to style the content via the light DOM since it is not encapsulated in a shadow root). | `--mdc-dialog-scroll-divider-color` | ![](images/color_0,0,0,12.png) `rgba(0, 0, 0, 0.12)` | Color of the dividers present when dialog is scrollable. | `--mdc-dialog-min-width` | `280px` | min-width ofthe dialog surface. @@ -333,7 +333,7 @@ For example: ```html - +
    In this example we set "dialogInitialFocus" on the mwc-textfield. When this dialog opens, it is auto-focused. diff --git a/packages/dialog/src/mwc-dialog-base.ts b/packages/dialog/src/mwc-dialog-base.ts index 761ada1eb..2adf0cb6f 100644 --- a/packages/dialog/src/mwc-dialog-base.ts +++ b/packages/dialog/src/mwc-dialog-base.ts @@ -59,7 +59,7 @@ export class DialogBase extends BaseElement { }) stacked = false; - @property({type: String}) title = ''; + @property({type: String}) heading = ''; @property({type: String}) @observer(function(this: DialogBase, newAction: string) { @@ -180,10 +180,10 @@ export class DialogBase extends BaseElement { [cssClasses.STACKED]: this.stacked, }; - let title = html``; + let heading = html``; - if (this.title) { - title = html`

    ${this.title}

    `; + if (this.heading) { + heading = html`

    ${this.heading}

    `; } const actionsClasses = { @@ -194,11 +194,11 @@ export class DialogBase extends BaseElement {
    - ${title} + ${heading}
    diff --git a/packages/dialog/src/mwc-dialog.scss b/packages/dialog/src/mwc-dialog.scss index 3851bbf3f..5d72917ee 100644 --- a/packages/dialog/src/mwc-dialog.scss +++ b/packages/dialog/src/mwc-dialog.scss @@ -103,7 +103,7 @@ limitations under the License. .mdc-dialog__title { @include mdc-feature-targets($feat-color) { @include mdc-theme-prop(color, ( - varname: --mdc-dialog-title-ink-color, + varname: --mdc-dialog-heading-ink-color, fallback: rgba(mdc-theme-prop-value($color), $opacity) )); } diff --git a/packages/dialog/src/test/mwc-dialog.test.ts b/packages/dialog/src/test/mwc-dialog.test.ts index 870177aee..487371d94 100644 --- a/packages/dialog/src/test/mwc-dialog.test.ts +++ b/packages/dialog/src/test/mwc-dialog.test.ts @@ -54,7 +54,7 @@ const opened = html` `; const withButtons = html` - + From 97028e0d7b45d0507231fc0357de42434577ab56 Mon Sep 17 00:00:00 2001 From: Elliott Marquez Date: Mon, 14 Oct 2019 16:13:57 -0700 Subject: [PATCH 2/4] fix aria in dialog --- packages/dialog/src/mwc-dialog-base.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/dialog/src/mwc-dialog-base.ts b/packages/dialog/src/mwc-dialog-base.ts index 2adf0cb6f..ca1dded41 100644 --- a/packages/dialog/src/mwc-dialog-base.ts +++ b/packages/dialog/src/mwc-dialog-base.ts @@ -183,7 +183,8 @@ export class DialogBase extends BaseElement { let heading = html``; if (this.heading) { - heading = html`

    ${this.heading}

    `; + heading = html` +

    ${this.heading}

    `; } const actionsClasses = { @@ -195,11 +196,11 @@ export class DialogBase extends BaseElement { role="alertdialog" aria-modal="true" aria-labelledby="title" - aria-describedby="my-dialog-content"> + aria-describedby="content">
    ${heading} -
    +