From 142f4f0b5aab197f4cb2cc8b3ae80f782fdb28e3 Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Fri, 28 Feb 2020 12:47:24 -0700 Subject: [PATCH 1/2] Better guarantee that a popover position can be found --- src/services/popover/popover_positioning.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/popover/popover_positioning.ts b/src/services/popover/popover_positioning.ts index 9e57d64438e..56b8a3c68ff 100644 --- a/src/services/popover/popover_positioning.ts +++ b/src/services/popover/popover_positioning.ts @@ -182,7 +182,7 @@ export function findPopoverPosition({ } } - let bestFit = -Infinity; + let bestFit: number | undefined = undefined; let bestPosition: FindPopoverPositionResult | null = null; for (let idx = 0; idx < iterationPositions.length; idx++) { @@ -201,7 +201,7 @@ export function findPopoverPosition({ arrowConfig, }); - if (screenCoordinates.fit > bestFit) { + if (bestFit === undefined || screenCoordinates.fit > bestFit) { bestFit = screenCoordinates.fit; bestPosition = { fit: screenCoordinates.fit, From f8e3aaaa6d35d2497f2759384762ee89e7e09844 Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Fri, 28 Feb 2020 12:52:34 -0700 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 1 + .../flyout/__snapshots__/flyout.test.tsx.snap | 43 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3319cfae43..e70017473dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Fixed `EuiTitle` not rendering child classes ([#2925](https://github.com/elastic/eui/pull/2925)) - Extended `div` element in `EuiFlyout` type ([#2914](https://github.com/elastic/eui/pull/2914)) +- Fixed popover positioning service to be more lenient when positioning 0-width or 0-height content ([#2948](https://github.com/elastic/eui/pull/2948)) **Theme: Amsterdam** diff --git a/src/components/flyout/__snapshots__/flyout.test.tsx.snap b/src/components/flyout/__snapshots__/flyout.test.tsx.snap index 769a9174016..047a7510a83 100644 --- a/src/components/flyout/__snapshots__/flyout.test.tsx.snap +++ b/src/components/flyout/__snapshots__/flyout.test.tsx.snap @@ -172,6 +172,49 @@ exports[`EuiFlyout max width can be set to a default 1`] = ` `; +exports[`EuiFlyout props accepts div props 1`] = ` +
+
+
+
+ +
+
+
+`; + exports[`EuiFlyout props close button is not rendered 1`] = `