-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Conversation
@@ -61,9 +61,9 @@ export function PostPublishButtonOrToggle( { | |||
( isPending && ! hasPublishAction && ! isSmallerThanMediumViewport ) | |||
) { | |||
component = IS_BUTTON; | |||
} else if ( isSmallerThanMediumViewport ) { | |||
} else if ( isSmallerThanMediumViewport && ! isPublishSidebarOpened ) { |
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.
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.
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.
Should a button be concerned with all that? Sounds like we might want to extract the layout management logic into another, higher-level component.
Size Change: +5 B (0%) Total Size: 1.04 MB
ℹ️ View Unchanged
|
Closing as the editor has advanced since this PR was created. |
Description
When you come to publish a post an actions panel appears with a "Publish" button:
In #32732 I discovered that there is actually a hidden "Publish" button stacked
underneath the actions panel.
Screen.Capture.on.2021-06-21.at.15-53-46.mp4
In actual fact this button is the button which is used to "toggle" the actions panel ("Publish sidebar") open. However once it toggles the action panel AFAIK this button is then intended not to be exposed in the UI because it is always obscured (via
z-index
) by the interface skeleton's "actions" panel which contains the "Publish" sidebar we're all used to interacting with. It is also not accessible via keyboard because focus is trapped within the actions panel.Nonetheless the case that this button exists and that is a little odd that it doesn't function as you'd expect. I believe once the button has been clicked and the actions panel is toggled then it should become a "Publish" button able to publish the post. Indeed this is what the component tries to do:
gutenberg/packages/edit-post/src/components/header/post-publish-button-or-toggle.js
Lines 58 to 81 in b332c75
In the code above the value of
isToggle
being passed to<PostPublishButton />
determines whether the button functions as a toggle or as a publish button.I believe we should either:
disabled
once the actions panel has been toggled.This might seem like an edge case but as shown here #32732 (comment) it's simple to introduce a change which exposes this hidden UI and it can cause a lot of confusion to both humans and the e2e tests.
Better to just remove or fix it.
I could be wrong here but didn't want to leave this odd feature/bug unresolved...
How has this been tested?
On trunk
.interface-interface-skeleton__body
to havez-index: 10
.On this PR branch
.interface-interface-skeleton__body
to havez-index: 10
.Screenshots
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).