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 22, 2023
1 parent 5b95e96 commit 37cb968
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 37cb968

Please sign in to comment.