Skip to content

Commit

Permalink
FormTokenField: Validate input before tokenizing on space
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvikpatel18 committed Feb 20, 2025
1 parent 693e315 commit ea754a2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/components/src/form-token-field/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,12 @@ export function FormTokenField( props: FormTokenFieldProps ) {
break;
case 'Space':
if ( tokenizeOnSpace ) {
preventDefault = addCurrentToken();
if (
inputHasValidValue() &&
__experimentalValidateInput( incompleteTokenValue )
) {
preventDefault = addCurrentToken();
}
}
break;
case 'Escape':
Expand Down

0 comments on commit ea754a2

Please sign in to comment.