Skip to content
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

Add conditions to ensure hidden/inactive "Publish" button is a toggle or a publish button depending on context. #32853

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ export function PostPublishButtonOrToggle( {
( isPending && ! hasPublishAction && ! isSmallerThanMediumViewport )
) {
component = IS_BUTTON;
} else if ( isSmallerThanMediumViewport ) {
} else if ( isSmallerThanMediumViewport && ! isPublishSidebarOpened ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we make sure the button only acts as a toggle if the sidebar feature is enabled and the actual sidebar is not yet opened.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should a button be concerned with all that? Sounds like we might want to extract the layout management logic into another, higher-level component.

component = IS_TOGGLE;
} else if ( isPublishSidebarEnabled ) {
} else if ( isPublishSidebarEnabled && ! isPublishSidebarOpened ) {
component = IS_TOGGLE;
} else {
component = IS_BUTTON;
Expand Down