Skip to content

Commit

Permalink
Editor: Always render the 'Switch to Draft' button to avoid focus loss (
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Sep 26, 2023
1 parent 9660466 commit cfbf45c
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ export default function PostSwitchToDraftButton() {
};
}, [] );

if ( ! isPublished && ! isScheduled ) {
return null;
}
const isDisabled = isSaving || ( ! isPublished && ! isScheduled );

let alertMessage;
if ( isPublished ) {
Expand All @@ -50,9 +48,11 @@ export default function PostSwitchToDraftButton() {
<Button
className="editor-post-switch-to-draft"
onClick={ () => {
setShowConfirmDialog( true );
if ( ! isDisabled ) {
setShowConfirmDialog( true );
}
} }
disabled={ isSaving }
aria-disabled={ isDisabled }
variant="secondary"
style={ { flexGrow: '1', justifyContent: 'center' } }
>
Expand Down

0 comments on commit cfbf45c

Please sign in to comment.