diff --git a/UNRELEASED.md b/UNRELEASED.md index f50d13b618d..c4c2d3133e2 100644 --- a/UNRELEASED.md +++ b/UNRELEASED.md @@ -6,6 +6,8 @@ ### Bug fixes +- Constrained `DropZone` height based on inherited wrapper height ([#2846](https://github.com/Shopify/polaris-react/pull/2846)) + ### Documentation ### Development workflow diff --git a/src/components/DropZone/DropZone.scss b/src/components/DropZone/DropZone.scss index 9029ba72225..95909e06379 100755 --- a/src/components/DropZone/DropZone.scss +++ b/src/components/DropZone/DropZone.scss @@ -38,8 +38,19 @@ $dropzone-stacking-order: ( border: border-width(thick) $dropzone-border-style transparent; } +.DropZoneWrapper { + height: 100%; + + > div { + height: 100%; + display: flex; + flex-direction: column; + } +} + .DropZone { position: relative; + flex: 1; display: flex; justify-content: center; background-color: $dropzone-background; diff --git a/src/components/DropZone/DropZone.tsx b/src/components/DropZone/DropZone.tsx index 0ce11f8be0b..a6d4d4df5cd 100755 --- a/src/components/DropZone/DropZone.tsx +++ b/src/components/DropZone/DropZone.tsx @@ -378,31 +378,33 @@ export const DropZone: React.FunctionComponent & { return ( - -
+ - {dragOverlay} - {dragErrorOverlay} -
{children}
- - - -
-
+
+ {dragOverlay} + {dragErrorOverlay} +
{children}
+ + + +
+ +
); diff --git a/src/components/DropZone/tests/DropZone.test.tsx b/src/components/DropZone/tests/DropZone.test.tsx index 5091cbd8f09..4f8a2b7b0b6 100755 --- a/src/components/DropZone/tests/DropZone.test.tsx +++ b/src/components/DropZone/tests/DropZone.test.tsx @@ -571,7 +571,7 @@ function fireEvent({ element .find('div') - .at(3) + .at(4) .getDOMNode() .dispatchEvent(event);