-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PostPublishPanel: return focus to element that opened the panel (#11543)
* Toggle disabled if post is published * Return focus to Publish... button - Do not unmount Header settings components. - Hide the "Save draft" button because it's not hidden by the PostPublishPanel slide-in sidebar. * Sort dependencies * Extract props * Toggle should be disabled if post is published * Add toggleProps to button * Inline text for toggle within the button component * Always render the button component * Use aria-disabled instead of disabled to avoid focus loss * Improve comments * Update snapshots * Add deprecation notice in editor CHANGELOG * Add deprecation notice in plugin * Add deprecation in component * Add DotTip to PostPublishButton * Fix deprecation warning in tests * Update PostPublishButton e2e tests to use aria-disabled instead of disabled att * Update e2e test This was relying on the preview button not being mounted while the publish panel was opened. A better logic is to check whether the actual publish panel is shown. * Tweak comment * Update version * Update packages/editor/src/components/post-publish-panel/toggle.js * Place component in a separate line Co-Authored-By: nosolosw <[email protected]> * Update version number * Add comment * Update comment * Tweak comment * chore: Move deps to 4.5
- Loading branch information
1 parent
a2fee33
commit fc03492
Showing
12 changed files
with
183 additions
and
102 deletions.
There are no files selected for viewing
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
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
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
36 changes: 30 additions & 6 deletions
36
packages/edit-post/src/components/header/test/__snapshots__/index.js.snap
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,37 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`PostPublishButtonOrToggle should render a button when post is not (1), (2), (3), the viewport is >= medium, and the publish sidebar is disabled 1`] = `<WithSelect(WithDispatch(PostPublishButton)) />`; | ||
exports[`PostPublishButtonOrToggle should render a button when post is not (1), (2), (3), the viewport is >= medium, and the publish sidebar is disabled 1`] = ` | ||
<WithSelect(WithDispatch(PostPublishButton)) | ||
isToggle={false} | ||
/> | ||
`; | ||
|
||
exports[`PostPublishButtonOrToggle should render a button when the post is pending and cannot be published but the viewport is >= medium (3) 1`] = `<WithSelect(WithDispatch(PostPublishButton)) />`; | ||
exports[`PostPublishButtonOrToggle should render a button when the post is pending and cannot be published but the viewport is >= medium (3) 1`] = ` | ||
<WithSelect(WithDispatch(PostPublishButton)) | ||
isToggle={false} | ||
/> | ||
`; | ||
|
||
exports[`PostPublishButtonOrToggle should render a button when the post is published (1) 1`] = `<WithSelect(WithDispatch(PostPublishButton)) />`; | ||
exports[`PostPublishButtonOrToggle should render a button when the post is published (1) 1`] = ` | ||
<WithSelect(WithDispatch(PostPublishButton)) | ||
isToggle={false} | ||
/> | ||
`; | ||
|
||
exports[`PostPublishButtonOrToggle should render a button when the post is scheduled (2) 1`] = `<WithSelect(WithDispatch(PostPublishButton)) />`; | ||
exports[`PostPublishButtonOrToggle should render a button when the post is scheduled (2) 1`] = ` | ||
<WithSelect(WithDispatch(PostPublishButton)) | ||
isToggle={false} | ||
/> | ||
`; | ||
|
||
exports[`PostPublishButtonOrToggle should render a toggle when post is not (1), (2), (3), the viewport is >= medium, and the publish sidebar is enabled 1`] = `<WithSelect(PostPublishPanelToggle) />`; | ||
exports[`PostPublishButtonOrToggle should render a toggle when post is not (1), (2), (3), the viewport is >= medium, and the publish sidebar is enabled 1`] = ` | ||
<WithSelect(WithDispatch(PostPublishButton)) | ||
isToggle={true} | ||
/> | ||
`; | ||
|
||
exports[`PostPublishButtonOrToggle should render a toggle when post is not published or scheduled and the viewport is < medium 1`] = `<WithSelect(PostPublishPanelToggle) />`; | ||
exports[`PostPublishButtonOrToggle should render a toggle when post is not published or scheduled and the viewport is < medium 1`] = ` | ||
<WithSelect(WithDispatch(PostPublishButton)) | ||
isToggle={true} | ||
/> | ||
`; |
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
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
Oops, something went wrong.