Skip to content

Commit

Permalink
Patterns: Require a title in the creation modal (#54717)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka authored Sep 22, 2023
1 parent f6d16f0 commit 5b95e96
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/patterns/src/components/create-pattern-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export default function CreatePatternModal( {
const { createErrorNotice } = useDispatch( noticesStore );

async function onCreate( patternTitle, sync ) {
if ( isSaving ) return;
if ( ! title || isSaving ) {
return;
}

try {
setIsSaving( true );
Expand Down Expand Up @@ -155,7 +157,7 @@ export default function CreatePatternModal( {
<Button
variant="primary"
type="submit"
aria-disabled={ isSaving }
aria-disabled={ ! title || isSaving }
isBusy={ isSaving }
>
{ __( 'Create' ) }
Expand Down

0 comments on commit 5b95e96

Please sign in to comment.