Skip to content

Commit

Permalink
Patterns: Require a title in the creation modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Sep 22, 2023
1 parent a6fd38b commit f79c1d4
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 f79c1d4

Please sign in to comment.