Skip to content

Commit

Permalink
Reset the autocompleter as previously
Browse files Browse the repository at this point in the history
  • Loading branch information
WunderBart committed Oct 12, 2023
1 parent b799705 commit 4bfa51b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/components/src/autocomplete/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ export function useAutocomplete( {
backspacing.current && wordsFromTrigger.length <= 3;

if ( mismatch && ! ( matchingWhileBackspacing || hasOneTriggerWord ) ) {
if ( autocompleter ) reset();
return;
}

Expand All @@ -293,17 +294,20 @@ export function useAutocomplete( {
textAfterSelection
)
) {
if ( autocompleter ) reset();
return;
}

if (
/^\s/.test( textWithoutTrigger ) ||
/\s\s+$/.test( textWithoutTrigger )
) {
if ( autocompleter ) reset();
return;
}

if ( ! /[\u0000-\uFFFF]*$/.test( textWithoutTrigger ) ) {
if ( autocompleter ) reset();
return;
}

Expand Down

0 comments on commit 4bfa51b

Please sign in to comment.