New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sidebar reacts to screen size and refactor to use interface package #22565
Sidebar reacts to screen size and refactor to use interface package #22565
Conversation
Size Change: +344 B (0%) Total Size: 1.12 MB
ℹ️ View Unchanged
|
isPostSaveable: select( 'core/editor' ).isEditedPostSaveable(), | ||
deviceType: select( | ||
'core/edit-post' | ||
).__experimentalGetPreviewDeviceType(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see these being used.
@@ -154,6 +146,7 @@ function Layout() { | |||
<LocalAutosaveMonitor /> | |||
<EditPostKeyboardShortcuts /> | |||
<EditorKeyboardShortcutsRegister /> | |||
<SettingsSidebar /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this moved here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our slot mechanism for complementary areas works with assumption multiple fills are rendered. Only the fill of the active complementary area is shown, but buttons to toggle the complementary area are rendered for all the areas.
Previously the core sidebar fill was only rendered when the sidebar was enabled, and we had a custom made toggle button for the sidebar.
This PR makes sure the core sidebars use the same logic as the plugin sidebars so we need to move SettingsSidebar to a position where it is unconditionoly rendered even if no sidebars are active. Otherwise, when no sidebars are active, we would not render the toggle button for core sidebars.
let sidebar = select( 'core/interface' ).getActiveComplementaryArea( | ||
'core/edit-post' | ||
); | ||
if ( | ||
! [ 'edit-post/document', 'edit-post/block' ].includes( sidebar ) | ||
) { | ||
if ( select( 'core/block-editor' ).getBlockSelectionStart() ) { | ||
sidebar = 'edit-post/block'; | ||
} | ||
sidebar = 'edit-post/document'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This deserves a comment. Why do we now have a fallback instead of returning null?
@@ -135,6 +146,7 @@ function Editor( { settings: _settings } ) { | |||
<Context.Provider value={ context }> | |||
<FocusReturnProvider> | |||
<KeyboardShortcuts.Register /> | |||
<Sidebar /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this sidebar out here now and how is it different from the new one below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have the fills for the slot below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that abstraction necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A name like SidebarComplementaryAreaFills
would make it easier to grasp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to https://github.com/WordPress/gutenberg/pull/22565/files#r430034009. We need to unconditionally render the fills even if currently we don't have an active sidebar. I renamed the component to SidebarComplementaryAreaFills 👍
width: calc(100% + 24px); | ||
} | ||
|
||
.edit-widgets-sidebar { | ||
z-index: z-index(".edit-widgets-sidebar"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can be merged.
…-widgets and edit-site; Add auto close on mobile sidebar behaviour interface package
Co-authored-by: Enrique Piqueras <epiqueras@users.noreply.github.com>
Co-authored-by: Enrique Piqueras <epiqueras@users.noreply.github.com>
Co-authored-by: Enrique Piqueras <epiqueras@users.noreply.github.com>
Co-authored-by: Enrique Piqueras <epiqueras@users.noreply.github.com>
cd29902
to
543e9e2
Compare
543e9e2
to
e8f0930
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @epiqueras thank you for the review. Your feedback was applied!
@@ -135,6 +146,7 @@ function Editor( { settings: _settings } ) { | |||
<Context.Provider value={ context }> | |||
<FocusReturnProvider> | |||
<KeyboardShortcuts.Register /> | |||
<Sidebar /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to https://github.com/WordPress/gutenberg/pull/22565/files#r430034009. We need to unconditionally render the fills even if currently we don't have an active sidebar. I renamed the component to SidebarComplementaryAreaFills 👍
packages/edit-post/src/components/sidebar/settings-sidebar/index.js
Outdated
Show resolved
Hide resolved
packages/edit-post/src/components/sidebar/settings-sidebar/index.js
Outdated
Show resolved
Hide resolved
packages/edit-post/src/components/sidebar/settings-sidebar/index.js
Outdated
Show resolved
Hide resolved
packages/edit-post/src/components/sidebar/settings-sidebar/index.js
Outdated
Show resolved
Hide resolved
packages/edit-post/src/components/sidebar/settings-sidebar/index.js
Outdated
Show resolved
Hide resolved
packages/edit-post/src/components/sidebar/settings-sidebar/index.js
Outdated
Show resolved
Hide resolved
…ex.js Co-authored-by: Enrique Piqueras <epiqueras@users.noreply.github.com>
…ex.js Co-authored-by: Enrique Piqueras <epiqueras@users.noreply.github.com>
…ex.js Co-authored-by: Enrique Piqueras <epiqueras@users.noreply.github.com>
…ex.js Co-authored-by: Enrique Piqueras <epiqueras@users.noreply.github.com>
…ex.js Co-authored-by: Enrique Piqueras <epiqueras@users.noreply.github.com>
…ex.js Co-authored-by: Enrique Piqueras <epiqueras@users.noreply.github.com>
Co-authored-by: Enrique Piqueras <epiqueras@users.noreply.github.com>
b1a359b
to
fa068eb
Compare
This PR applies the following changes: