-
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
Disabled conditions for publish buttons #11584
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oandregal
force-pushed
the
fix/disable-publish
branch
from
November 8, 2018 09:13
53f0b4a
to
5de5bc2
Compare
@tofumatt this is part of figuring out the accessibility stuff. I'm trying to merge this two buttons, which implies I need to understand (and fix!) their enable/disable states. |
oandregal
force-pushed
the
fix/disable-publish
branch
from
November 8, 2018 11:37
dd60a37
to
0c91e4b
Compare
1 task
The test was passing due to wrong conditions.
oandregal
force-pushed
the
fix/disable-publish
branch
from
November 8, 2018 13:35
0c91e4b
to
4075b57
Compare
tofumatt
approved these changes
Nov 9, 2018
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.
Worked for me! The manual testing instructions here read like they'd make good E2E tests 😏
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Feature] Document Settings
Document settings experience
[Type] Bug
An existing feature does not function as intended
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have two components that can be used to publish a post:
PostPublishToggle
orPostPublishPanelButton
. The first will open thePostPublishPanel
sidebar, the second is used in thePostPublishPanel
sidebar, and substitutes the toggle when pre-publish checks are disabled or when the post is published.The conditions under which they are disabled are different at the moment, tests pass due to wrong assumptions and/or conditions aren't met. In bold what this PR fixes:
Testing
Button and Toggle are disabled while a draft is being saved
They should look like this:
Note that when a post is being published, the button should show a busy status instead:
Button and Toggle are disabled when forceIsSaving is true
wp.data.dispatch( 'core/edit-post' ).requestMetaBoxUpdates();
They should look like this:
Toggle is disabled if post is published
No manual testing for this, we have a unit test that covers it. In Gutenberg case, the toggle is never shown if the post is published (we show the button instead). TLDR: at this point in the release cycle I don't want to introduce API changes.
Toggle is enabled if post is saveable (has contents) and forceIsDirty
No manual test for this either. Same reasons than above. Note that
forceIsDirty
has been added here as a new condition just for completeness. It doesn't modifies API.