diff --git a/demos/drawer/drawer.scss b/demos/drawer/drawer.scss index d74cfc19775..388c4018827 100644 --- a/demos/drawer/drawer.scss +++ b/demos/drawer/drawer.scss @@ -78,6 +78,7 @@ } .demo-content { + position: relative; flex: auto; overflow: auto; background: #fff; diff --git a/demos/drawer/permanent-drawer.html b/demos/drawer/permanent-drawer.html index 68ad15ece3e..17c27e52633 100644 --- a/demos/drawer/permanent-drawer.html +++ b/demos/drawer/permanent-drawer.html @@ -104,11 +104,14 @@
Labels
-
+
Permanent Drawer
+
diff --git a/packages/mdc-drawer/README.md b/packages/mdc-drawer/README.md index 070200997f7..5f5b185da67 100644 --- a/packages/mdc-drawer/README.md +++ b/packages/mdc-drawer/README.md @@ -335,6 +335,7 @@ Mixin | Description `mdc-drawer-activated-overlay-color($color)` | Sets the overlay color of the activated drawer list item. `mdc-drawer-scrim-fill-color($color)` | Sets the fill color of `mdc-drawer-scrim`. `mdc-drawer-z-index($value)` | Sets the z index of drawer. Drawer stays on top of top app bar except for clipped variant of drawer. +`mdc-drawer-width($width)` | Sets the width of the drawer. In the case of the dismissible variant, also sets margin required for `mdc-drawer-app-content`. ## Accessibility diff --git a/packages/mdc-drawer/_mixins.scss b/packages/mdc-drawer/_mixins.scss index c7d3ab65c7f..6de8149cfbe 100644 --- a/packages/mdc-drawer/_mixins.scss +++ b/packages/mdc-drawer/_mixins.scss @@ -122,3 +122,11 @@ @mixin mdc-drawer-z-index($value) { z-index: $value; } + +@mixin mdc-drawer-width($width) { + width: $width; + + &.mdc-drawer--open:not(.mdc-drawer--closing) + .mdc-drawer-app-content { + @include mdc-rtl-reflexive-box(margin, left, $width); + } +} diff --git a/packages/mdc-drawer/common.scss b/packages/mdc-drawer/common.scss index ae1c0915784..80a3ca0331d 100644 --- a/packages/mdc-drawer/common.scss +++ b/packages/mdc-drawer/common.scss @@ -41,13 +41,12 @@ @include mdc-drawer-item-activated-text-ink-color($mdc-drawer-item-activated-ink-color); @include mdc-drawer-item-corner-radius(4px); @include mdc-drawer-z-index($mdc-drawer-z-index); + @include mdc-drawer-width($mdc-drawer-width); display: flex; flex-direction: column; flex-shrink: 0; box-sizing: border-box; - width: $mdc-drawer-width; - max-width: $mdc-drawer-width; height: 100%; transition-property: transform; transition-timing-function: $mdc-animation-standard-curve-timing-function; diff --git a/packages/mdc-drawer/dismissible/mdc-drawer-dismissible.scss b/packages/mdc-drawer/dismissible/mdc-drawer-dismissible.scss index 2ea0c520c99..3d02b4ba456 100644 --- a/packages/mdc-drawer/dismissible/mdc-drawer-dismissible.scss +++ b/packages/mdc-drawer/dismissible/mdc-drawer-dismissible.scss @@ -42,10 +42,6 @@ position: relative; - .mdc-drawer--open + & { - @include mdc-rtl-reflexive-box(margin, left, $mdc-drawer-width); - } - .mdc-drawer--closing + & { @include mdc-rtl-reflexive-box(margin, left, 0); } diff --git a/test/screenshot/golden.json b/test/screenshot/golden.json index 6a2dfe6466d..6a8166938d5 100644 --- a/test/screenshot/golden.json +++ b/test/screenshot/golden.json @@ -198,48 +198,57 @@ } }, "spec/mdc-drawer/classes/dismissible.html": { - "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/classes/dismissible.html", + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/classes/dismissible.html?utm_source=golden_json", "screenshots": { - "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/classes/dismissible.html.windows_chrome_68.png", - "desktop_windows_edge@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/classes/dismissible.html.windows_edge_17.png", - "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/classes/dismissible.html.windows_firefox_61.png", - "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/classes/dismissible.html.windows_ie_11.png" + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/classes/dismissible.html.windows_chrome_68.png", + "desktop_windows_edge@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/classes/dismissible.html.windows_edge_17.png", + "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/classes/dismissible.html.windows_firefox_61.png", + "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/classes/dismissible.html.windows_ie_11.png" } }, "spec/mdc-drawer/classes/modal.html": { - "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/classes/modal.html", + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/classes/modal.html?utm_source=golden_json", "screenshots": { - "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/classes/modal.html.windows_chrome_68.png", - "desktop_windows_edge@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/classes/modal.html.windows_edge_17.png", - "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/classes/modal.html.windows_firefox_61.png", - "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/classes/modal.html.windows_ie_11.png" + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/classes/modal.html.windows_chrome_68.png", + "desktop_windows_edge@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/classes/modal.html.windows_edge_17.png", + "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/classes/modal.html.windows_firefox_61.png", + "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/classes/modal.html.windows_ie_11.png" } }, "spec/mdc-drawer/classes/permanent.html": { - "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/classes/permanent.html", + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/classes/permanent.html?utm_source=golden_json", "screenshots": { - "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/classes/permanent.html.windows_chrome_68.png", - "desktop_windows_edge@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/classes/permanent.html.windows_edge_17.png", - "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/classes/permanent.html.windows_firefox_61.png", - "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/classes/permanent.html.windows_ie_11.png" + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/classes/permanent.html.windows_chrome_68.png", + "desktop_windows_edge@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/classes/permanent.html.windows_edge_17.png", + "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/classes/permanent.html.windows_firefox_61.png", + "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/classes/permanent.html.windows_ie_11.png" } }, "spec/mdc-drawer/mixins/fill-color-accessible.html": { - "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/mixins/fill-color-accessible.html", + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/mixins/fill-color-accessible.html?utm_source=golden_json", "screenshots": { - "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/mixins/fill-color-accessible.html.windows_chrome_68.png", - "desktop_windows_edge@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/mixins/fill-color-accessible.html.windows_edge_17.png", - "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/mixins/fill-color-accessible.html.windows_firefox_61.png", - "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/mixins/fill-color-accessible.html.windows_ie_11.png" + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/mixins/fill-color-accessible.html.windows_chrome_68.png", + "desktop_windows_edge@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/mixins/fill-color-accessible.html.windows_edge_17.png", + "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/mixins/fill-color-accessible.html.windows_firefox_61.png", + "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/mixins/fill-color-accessible.html.windows_ie_11.png" } }, "spec/mdc-drawer/mixins/fill-color.html": { - "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/mixins/fill-color.html", + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/mixins/fill-color.html?utm_source=golden_json", "screenshots": { - "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/mixins/fill-color.html.windows_chrome_68.png", - "desktop_windows_edge@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/mixins/fill-color.html.windows_edge_17.png", - "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/mixins/fill-color.html.windows_firefox_61.png", - "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/advorak/2018/08/29/10_31_51_582/spec/mdc-drawer/mixins/fill-color.html.windows_ie_11.png" + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/mixins/fill-color.html.windows_chrome_68.png", + "desktop_windows_edge@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/mixins/fill-color.html.windows_edge_17.png", + "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/mixins/fill-color.html.windows_firefox_61.png", + "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/mixins/fill-color.html.windows_ie_11.png" + } + }, + "spec/mdc-drawer/mixins/width.html": { + "public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/mixins/width.html?utm_source=golden_json", + "screenshots": { + "desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/mixins/width.html.windows_chrome_68.png", + "desktop_windows_edge@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/mixins/width.html.windows_edge_17.png", + "desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/mixins/width.html.windows_firefox_61.png", + "desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/abhiomkar/2018/08/29/20_29_11_479/spec/mdc-drawer/mixins/width.html.windows_ie_11.png" } }, "spec/mdc-elevation/classes/baseline-large.html": { diff --git a/test/screenshot/spec/mdc-drawer/classes/dismissible.html b/test/screenshot/spec/mdc-drawer/classes/dismissible.html index fee8e6ade5e..7cfabf3a65e 100644 --- a/test/screenshot/spec/mdc-drawer/classes/dismissible.html +++ b/test/screenshot/spec/mdc-drawer/classes/dismissible.html @@ -48,58 +48,63 @@
Title here
Subtext
- +
-
+
Dismissible Drawer
+
diff --git a/test/screenshot/spec/mdc-drawer/classes/modal.html b/test/screenshot/spec/mdc-drawer/classes/modal.html index d07fc8a3087..1e810acdcd7 100644 --- a/test/screenshot/spec/mdc-drawer/classes/modal.html +++ b/test/screenshot/spec/mdc-drawer/classes/modal.html @@ -48,59 +48,63 @@
Title here
Subtext
- +
-
-
+
Modal Drawer
+
diff --git a/test/screenshot/spec/mdc-drawer/classes/permanent.html b/test/screenshot/spec/mdc-drawer/classes/permanent.html index 3af6bca6d4e..c3b4d56e98b 100644 --- a/test/screenshot/spec/mdc-drawer/classes/permanent.html +++ b/test/screenshot/spec/mdc-drawer/classes/permanent.html @@ -48,57 +48,62 @@
Title here
Subtext
- +
-
+
Permanent Drawer
+
diff --git a/test/screenshot/spec/mdc-drawer/fixture.scss b/test/screenshot/spec/mdc-drawer/fixture.scss index f3be1cf3e46..2cb9fa0fb2f 100644 --- a/test/screenshot/spec/mdc-drawer/fixture.scss +++ b/test/screenshot/spec/mdc-drawer/fixture.scss @@ -23,6 +23,7 @@ @import "../../../../packages/mdc-drawer/mixins"; @import "../../../../packages/mdc-drawer/variables"; @import "../../../../packages/mdc-typography/mdc-typography"; +@import "../../../../packages/mdc-typography/mixins"; @import "../../../../packages/mdc-top-app-bar/mdc-top-app-bar"; @import "../../../../packages/mdc-list/mixins"; @import "../../../../packages/mdc-theme/color-palette"; @@ -30,8 +31,12 @@ $custom-drawer-color: $material-color-orange-900; .test-viewport--drawer { + @include mdc-typography-base; + + height: 100vh; display: flex; flex-direction: row; + overflow: hidden; } .test-drawer-column { @@ -41,16 +46,20 @@ $custom-drawer-color: $material-color-orange-900; .test-drawer-app-content { flex: auto; - height: 100vh; - overflow: auto; +} + +.test-drawer-top-app-bar { + position: absolute; } .test-drawer-main-content { display: block; // Needed for IE 11 - height: calc(100% - 64px); + height: 100%; padding-right: 16px; padding-left: 16px; overflow: auto; + box-sizing: border-box; + background: #fff; } .custom-drawer--fill-color { @@ -60,3 +69,7 @@ $custom-drawer-color: $material-color-orange-900; .custom-drawer--fill-color-accessible { @include mdc-drawer-fill-color-accessible(darkcyan); } + +.custom-drawer--width { + @include mdc-drawer-width(400px); +} diff --git a/test/screenshot/spec/mdc-drawer/mixins/fill-color-accessible.html b/test/screenshot/spec/mdc-drawer/mixins/fill-color-accessible.html index a9295179ffd..ec2840677cb 100644 --- a/test/screenshot/spec/mdc-drawer/mixins/fill-color-accessible.html +++ b/test/screenshot/spec/mdc-drawer/mixins/fill-color-accessible.html @@ -48,57 +48,62 @@
Title here
Subtext
- +
-
+
Permanent Drawer
+
diff --git a/test/screenshot/spec/mdc-drawer/mixins/fill-color.html b/test/screenshot/spec/mdc-drawer/mixins/fill-color.html index b77ed7ba812..bb32a1f89d7 100644 --- a/test/screenshot/spec/mdc-drawer/mixins/fill-color.html +++ b/test/screenshot/spec/mdc-drawer/mixins/fill-color.html @@ -48,57 +48,62 @@
Title here
Subtext
- +
-
+
Permanent Drawer
+
diff --git a/test/screenshot/spec/mdc-drawer/mixins/width.html b/test/screenshot/spec/mdc-drawer/mixins/width.html new file mode 100644 index 00000000000..dff2a4ebd82 --- /dev/null +++ b/test/screenshot/spec/mdc-drawer/mixins/width.html @@ -0,0 +1,151 @@ + + + + + + Dismissible Drawer - MDC Web Screenshot Test + + + + + + + + + +
+ + +
+
+
+
+ + Dismissible Drawer +
+ +
+
+ +
+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
+ enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
+ aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
+ voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
+ occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
+ anim id est laborum. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
+ enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
+ aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
+ voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
+ occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
+ anim id est laborum. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
+ enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
+ aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
+ voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
+ occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
+ anim id est laborum. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
+ enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
+ aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
+ voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
+ occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
+ anim id est laborum. +

+
+
+
+ + + + + + + + + +