diff --git a/packages/base-styles/_z-index.scss b/packages/base-styles/_z-index.scss index fdf3ee586a9c3..945755f512ae7 100644 --- a/packages/base-styles/_z-index.scss +++ b/packages/base-styles/_z-index.scss @@ -140,6 +140,7 @@ $z-layers: ( ".components-popover.block-editor-inserter__popover": 99999, ".components-popover.table-of-contents__popover": 99998, ".components-popover.interface-more-menu__content": 99998, + ".components-popover.more-menu__content": 99998, ".components-popover.block-editor-rich-text__inline-format-toolbar": 99998, ".components-popover.block-editor-warning__dropdown": 99998, diff --git a/packages/customize-widgets/src/components/more-menu/index.js b/packages/customize-widgets/src/components/more-menu/index.js index 9a276976dc1fd..a0fb374057ec3 100644 --- a/packages/customize-widgets/src/components/more-menu/index.js +++ b/packages/customize-widgets/src/components/more-menu/index.js @@ -9,10 +9,9 @@ import { } from '@wordpress/components'; import { useState } from '@wordpress/element'; import { __, _x } from '@wordpress/i18n'; -import { external } from '@wordpress/icons'; +import { external, moreVertical } from '@wordpress/icons'; import { displayShortcut } from '@wordpress/keycodes'; import { useShortcut } from '@wordpress/keyboard-shortcuts'; -import { MoreMenuDropdown } from '@wordpress/interface'; import { PreferenceToggleMenuItem } from '@wordpress/preferences'; /** @@ -35,7 +34,18 @@ export default function MoreMenu() { return ( <> - + { () => ( <> @@ -106,7 +116,7 @@ export default function MoreMenu() { ) } - + { const isLargeViewport = useViewportMatch( 'large' ); return ( - @@ -54,7 +58,7 @@ const MoreMenu = ( { showIconLabels } ) => { ) } - + ); }; diff --git a/packages/edit-post/src/components/header/style.scss b/packages/edit-post/src/components/header/style.scss index 8bea8a7993b8d..5dfec8eabe339 100644 --- a/packages/edit-post/src/components/header/style.scss +++ b/packages/edit-post/src/components/header/style.scss @@ -322,3 +322,7 @@ z-index: 35; } } + +.components-popover.more-menu-dropdown__content { + z-index: z-index(".components-popover.more-menu__content"); +} diff --git a/packages/edit-site/src/components/header-edit-mode/more-menu/index.js b/packages/edit-site/src/components/header-edit-mode/more-menu/index.js index ef8e7ee0c40f8..00a61aa7492ec 100644 --- a/packages/edit-site/src/components/header-edit-mode/more-menu/index.js +++ b/packages/edit-site/src/components/header-edit-mode/more-menu/index.js @@ -4,13 +4,14 @@ import { __, _x } from '@wordpress/i18n'; import { useSelect, useDispatch } from '@wordpress/data'; import { displayShortcut } from '@wordpress/keycodes'; -import { external } from '@wordpress/icons'; -import { MenuGroup, MenuItem, VisuallyHidden } from '@wordpress/components'; +import { external, moreVertical } from '@wordpress/icons'; import { - ActionItem, - MoreMenuDropdown, - store as interfaceStore, -} from '@wordpress/interface'; + MenuGroup, + MenuItem, + VisuallyHidden, + DropdownMenu, +} from '@wordpress/components'; +import { ActionItem, store as interfaceStore } from '@wordpress/interface'; import { PreferenceToggleMenuItem, store as preferencesStore, @@ -55,10 +56,18 @@ export default function MoreMenu( { showIconLabels } ) { return ( <> - { ( { onClose } ) => ( @@ -162,7 +171,7 @@ export default function MoreMenu( { showIconLabels } ) { ) } - + diff --git a/packages/edit-site/src/components/header-edit-mode/style.scss b/packages/edit-site/src/components/header-edit-mode/style.scss index e47c51d94c434..b87da10d6db6e 100644 --- a/packages/edit-site/src/components/header-edit-mode/style.scss +++ b/packages/edit-site/src/components/header-edit-mode/style.scss @@ -256,3 +256,7 @@ $header-toolbar-min-width: 335px; .edit-site-header-edit-mode__block-tools-toggle { margin-left: 2px; // Allow focus ring to be fully visible } + +.components-popover.more-menu-dropdown__content { + z-index: z-index(".components-popover.more-menu__content"); +} diff --git a/packages/edit-widgets/src/components/more-menu/index.js b/packages/edit-widgets/src/components/more-menu/index.js index bb3e01bd19e26..2613f3d605ff8 100644 --- a/packages/edit-widgets/src/components/more-menu/index.js +++ b/packages/edit-widgets/src/components/more-menu/index.js @@ -1,11 +1,15 @@ /** * WordPress dependencies */ -import { MenuGroup, MenuItem, VisuallyHidden } from '@wordpress/components'; +import { + MenuGroup, + MenuItem, + VisuallyHidden, + DropdownMenu, +} from '@wordpress/components'; import { useState } from '@wordpress/element'; import { __, _x } from '@wordpress/i18n'; -import { external } from '@wordpress/icons'; -import { MoreMenuDropdown } from '@wordpress/interface'; +import { external, moreVertical } from '@wordpress/icons'; import { PreferenceToggleMenuItem } from '@wordpress/preferences'; import { displayShortcut } from '@wordpress/keycodes'; import { useShortcut } from '@wordpress/keyboard-shortcuts'; @@ -34,7 +38,18 @@ export default function MoreMenu() { return ( <> - + { ( onClose ) => ( <> { isLargeViewport && ( @@ -134,7 +149,7 @@ export default function MoreMenu() { ) } - + - { () => ( - - - { __( 'Keyboard Shortcuts' ) } - - - { __( 'Editor Preferences' ) } - - - ) } - - ); -} -``` - -## Props - -### as - -Provide a component that the dropdown should render as. This may be useful if you need `MoreMenuDropdown` to render a `ToolbarDropdownMenu` instead of a `DropdownMenu`. Defaults to `DropdownMenu`. - -- Type: `Component` -- Required: No. - -### className - -Provide an additional class name to the dropdown component. - -- Type: `String` -- Required: No - -### label - -Change the label of the button that opens the dropdown. - -- Default: 'Options' -- Type: `String` -- Required: No - -### popoverProps - -Override or extend the dropdown's popover props. - -See the documentation for the `DropdownMenu` and `Popover` components in the `@wordpress/components` package for more information. - -- Type: `Object` -- Required: No - -### toggleProps - -Override or extend the dropdown's toggle props. - -See the documentation for the `DropdownMenu` and `Button` components in the `@wordpress/components` package for more information. - -- Type: `Object` -- Required: No diff --git a/packages/interface/src/components/more-menu-dropdown/index.js b/packages/interface/src/components/more-menu-dropdown/index.js deleted file mode 100644 index dafa4b2e4b3b4..0000000000000 --- a/packages/interface/src/components/more-menu-dropdown/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * External dependencies - */ -import classnames from 'classnames'; - -/** - * WordPress dependencies - */ -import { DropdownMenu } from '@wordpress/components'; -import { __ } from '@wordpress/i18n'; -import { moreVertical } from '@wordpress/icons'; - -export default function MoreMenuDropdown( { - as: DropdownComponent = DropdownMenu, - className, - /* translators: button label text should, if possible, be under 16 characters. */ - label = __( 'Options' ), - popoverProps, - toggleProps, - children, -} ) { - return ( - - { ( onClose ) => children( onClose ) } - - ); -} diff --git a/packages/interface/src/components/more-menu-dropdown/style.scss b/packages/interface/src/components/more-menu-dropdown/style.scss deleted file mode 100644 index a2b9b1481677e..0000000000000 --- a/packages/interface/src/components/more-menu-dropdown/style.scss +++ /dev/null @@ -1,34 +0,0 @@ -.interface-more-menu-dropdown { - margin-left: -4px; - - // the padding and margin of the more menu is intentionally non-standard - .components-button { - width: auto; - padding: 0 2px; - } - - @include break-small() { - margin-left: 0; - - .components-button { - padding: 0 4px; - } - } -} - -.interface-more-menu-dropdown__content .components-popover__content { - min-width: 300px; - - // Let the menu scale to fit items. - @include break-mobile() { - max-width: $break-mobile; - } - - .components-dropdown-menu__menu { - padding: 0; - } -} - -.components-popover.interface-more-menu-dropdown__content { - z-index: z-index(".components-popover.interface-more-menu__content"); -} diff --git a/packages/interface/src/style.scss b/packages/interface/src/style.scss index e6950de411156..d7f1e35e6e661 100644 --- a/packages/interface/src/style.scss +++ b/packages/interface/src/style.scss @@ -2,5 +2,4 @@ @import "./components/complementary-area/style.scss"; @import "./components/fullscreen-mode/style.scss"; @import "./components/interface-skeleton/style.scss"; -@import "./components/more-menu-dropdown/style.scss"; @import "./components/pinned-items/style.scss"; diff --git a/packages/preferences/README.md b/packages/preferences/README.md index f35f4cdc4e9b9..448eb69a9b363 100644 --- a/packages/preferences/README.md +++ b/packages/preferences/README.md @@ -138,12 +138,10 @@ wp.data.dispatch( 'core/preferences' ).setPersistenceLayer( { The `PreferenceToggleMenuItem` components can be used with a `DropdownMenu` to implement a menu for changing preferences. -Also see the `MoreMenuDropdown` component from the `@wordpress/interface` package for implementing a more menu. - ```jsx function MyEditorMenu() { return ( - + { () => ( ) } - + ); } ```