From 2106d459bf7ff4322520a280483d0303b1ec7a31 Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Fri, 17 Aug 2018 16:16:04 +1000 Subject: [PATCH 1/2] Move MoreMenu-specific styling away from Popover CSS Moves CSS rules that are specific to styling the MoreMenu component out of the Popover CSS file and into the MoreMenu's CSS file. This fixes DotTips from appearing too narrow, and should prevent other components that use Popover from being inadvertently styled differently. --- edit-post/components/header/more-menu/index.js | 6 ++++-- edit-post/components/header/more-menu/style.scss | 10 +++++++++- packages/components/src/popover/style.scss | 7 ------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/edit-post/components/header/more-menu/index.js b/edit-post/components/header/more-menu/index.js index 19e6feb2210b32..74327c6df032cf 100644 --- a/edit-post/components/header/more-menu/index.js +++ b/edit-post/components/header/more-menu/index.js @@ -3,6 +3,7 @@ */ import { __, _x } from '@wordpress/i18n'; import { IconButton, Dropdown, MenuGroup } from '@wordpress/components'; +import { Fragment } from '@wordpress/element'; /** * Internal dependencies @@ -17,6 +18,7 @@ import KeyboardShortcutsHelpMenuItem from '../keyboard-shortcuts-help-menu-item' const MoreMenu = () => ( ( ( /> ) } renderContent={ ( { onClose } ) => ( -
+ ( > -
+ ) } /> ); diff --git a/edit-post/components/header/more-menu/style.scss b/edit-post/components/header/more-menu/style.scss index e4b6478e593419..fee9a7fe0c6130 100644 --- a/edit-post/components/header/more-menu/style.scss +++ b/edit-post/components/header/more-menu/style.scss @@ -20,7 +20,15 @@ } } -.edit-post-more-menu__content { +.edit-post-more-menu__content .components-popover__content { + min-width: 260px; + + // Let the menu scale to fit items. + @include break-mobile() { + width: auto; + max-width: $break-mobile; + } + .components-menu-group:not(:last-child), > div:not(:last-child) .components-menu-group { border-bottom: $border-width solid $light-gray-500; diff --git a/packages/components/src/popover/style.scss b/packages/components/src/popover/style.scss index 8d59ef572824a0..1bde0864445879 100644 --- a/packages/components/src/popover/style.scss +++ b/packages/components/src/popover/style.scss @@ -151,13 +151,6 @@ $arrow-size: 8px; position: absolute; height: auto; overflow-y: auto; - - // Let the menu scale to fit items. - min-width: 260px; - @include break-mobile() { - width: auto; - max-width: $break-mobile; - } } .components-popover:not(.is-mobile).is-top & { From 04d7bbae3d3e641a0a8087a3231a2abce48c9535 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 17 Aug 2018 09:50:59 +0100 Subject: [PATCH 2/2] Fix unit tests --- .../components/header/more-menu/test/__snapshots__/index.js.snap | 1 + 1 file changed, 1 insertion(+) diff --git a/edit-post/components/header/more-menu/test/__snapshots__/index.js.snap b/edit-post/components/header/more-menu/test/__snapshots__/index.js.snap index b4b682a24b1fd9..8b50b89f61c230 100644 --- a/edit-post/components/header/more-menu/test/__snapshots__/index.js.snap +++ b/edit-post/components/header/more-menu/test/__snapshots__/index.js.snap @@ -4,6 +4,7 @@ exports[`MoreMenu should match snapshot 1`] = `