diff --git a/package-lock.json b/package-lock.json index d6f75af998e310..761595fbc98162 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59612,6 +59612,7 @@ "@wordpress/private-apis": "file:../private-apis", "@wordpress/route": "file:../route", "@wordpress/theme": "file:../theme", + "@wordpress/ui": "file:../ui", "@wordpress/url": "file:../url", "clsx": "^2.1.1" }, diff --git a/packages/boot/package.json b/packages/boot/package.json index 4e86b400e0ff0f..e32c1de24e92bf 100644 --- a/packages/boot/package.json +++ b/packages/boot/package.json @@ -62,6 +62,7 @@ "@wordpress/private-apis": "file:../private-apis", "@wordpress/route": "file:../route", "@wordpress/theme": "file:../theme", + "@wordpress/ui": "file:../ui", "@wordpress/url": "file:../url", "clsx": "^2.1.1" }, diff --git a/packages/boot/src/components/root/index.tsx b/packages/boot/src/components/root/index.tsx index 275e8e622d2259..79b8d700a46283 100644 --- a/packages/boot/src/components/root/index.tsx +++ b/packages/boot/src/components/root/index.tsx @@ -19,6 +19,8 @@ import { menu } from '@wordpress/icons'; import { useState, useEffect } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { Page } from '@wordpress/admin-ui'; +// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout. +import { Tooltip } from '@wordpress/ui'; /** * Internal dependencies @@ -59,130 +61,138 @@ export default function Root() { return ( - - -
- - - { isMobileViewport && ( - -
+ onKeyDown={ ( event ) => { + if ( event.key === 'Escape' ) { + setIsMobileSidebarOpen( + false + ); + } + } } + role="button" + tabIndex={ -1 } + aria-label={ __( + 'Close navigation panel' ) } - - - ) } -
+ ) } + + { /* Mobile Sidebar */ } + + { isMobileViewport && + isMobileSidebarOpen && + ! isFullScreen && ( + + + + ) } + + { /* Desktop Sidebar */ } + { ! isMobileViewport && ! isFullScreen && ( +
+ +
+ ) } +
+ + + { /* Render Canvas in Root to prevent remounting on route changes */ } + { ( canvas || canvas === null ) && ( +
+ { canvas?.isPreview && + isMobileViewport && ( +
+
+ ) } + +
+ ) } +
+
- +
- +
); } diff --git a/packages/boot/src/components/save-button/index.tsx b/packages/boot/src/components/save-button/index.tsx index 9f40c50591883e..bfa87e1e8fb834 100644 --- a/packages/boot/src/components/save-button/index.tsx +++ b/packages/boot/src/components/save-button/index.tsx @@ -8,7 +8,9 @@ import { store as coreStore } from '@wordpress/core-data'; import { displayShortcut, rawShortcut } from '@wordpress/keycodes'; import { check } from '@wordpress/icons'; import { EntitiesSavedStates } from '@wordpress/editor'; -import { Button, Modal, Tooltip as WCTooltip } from '@wordpress/components'; +import { Button, Modal } from '@wordpress/components'; +// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout. +import { Tooltip } from '@wordpress/ui'; /** * Internal dependencies @@ -82,28 +84,37 @@ export default function SaveButton() { ); }; const label = getLabel(); + const shortcut = displayShortcut.primary( 's' ); return ( <> - - - + + setIsSaveViewOpened( true ) } + onBlur={ hideSavedState } + disabled={ disabled } + accessibleWhenDisabled + isBusy={ isSaving } + aria-keyshortcuts={ rawShortcut.primary( 's' ) } + className="boot-save-button" + icon={ isInSavedState ? check : undefined } + > + { label } + + } + /> + + { hasChanges && label } + { /* TODO: replace with a future `@wordpress/ui` `Shortcut` primitive once available; until then, render the shortcut inline with a local class name to avoid leaking the `components-*` namespace outside `@wordpress/components`. */ } + + { shortcut } + + + { isSaveViewOpen && ( - { - // If possible, restore the previous page with - // filters etc. - if ( canGoBack && isBackButton ) { - event.preventDefault(); - router.history.back(); - } - } } - > - - - + + { + // If possible, restore the previous page with + // filters etc. + if ( canGoBack && isBackButton ) { + event.preventDefault(); + router.history.back(); + } + } } + > + + + } + /> + }> + { props[ 'aria-label' ] } + + ); }