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 and mikachan committed Sep 22, 2023
1 parent 3de742f commit 46697a3
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 46697a3

Please sign in to comment.