File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
src/components/fields/ComboBox Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -318,8 +318,8 @@ WithinFormWithLegacyFieldAndCustomValue.args = {
318318 allowsCustomValue : true ,
319319} ;
320320
321- export const WithinFormStopPropagation = TemplateFormPropagation . bind ( { } ) ;
322- WithinFormStopPropagation . play = async ( { canvasElement } ) => {
321+ export const WithinFormStopEnterPropagation = TemplateFormPropagation . bind ( { } ) ;
322+ WithinFormStopEnterPropagation . play = async ( { canvasElement } ) => {
323323 const { getByTestId } = within ( canvasElement ) ;
324324
325325 const input = getByTestId ( 'Input' ) ;
@@ -329,3 +329,14 @@ WithinFormStopPropagation.play = async ({ canvasElement }) => {
329329 '{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}blurring{enter}' ,
330330 ) ;
331331} ;
332+
333+ export const WithinFormStopBlurPropagation = TemplateFormPropagation . bind ( { } ) ;
334+ WithinFormStopBlurPropagation . play = async ( { canvasElement } ) => {
335+ const { getByTestId } = within ( canvasElement ) ;
336+
337+ const input = getByTestId ( 'Input' ) ;
338+
339+ await userEvent . type ( input , '!' ) ;
340+ const button = getByTestId ( 'Button' ) ;
341+ await userEvent . click ( button ) ;
342+ } ;
Original file line number Diff line number Diff line change @@ -347,7 +347,7 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>(
347347 . includes ( inputRef . current ?. value )
348348 ) {
349349 // If the input value is not in the collection, we need to prevent the submitting of the form.
350- // This is because the input value is not a valid option and will be reset .
350+ // Also, we reset value manually .
351351 e . preventDefault ( ) ;
352352 props . onSelectionChange ?.( null ) ;
353353 }
@@ -367,6 +367,7 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>(
367367 } ) ;
368368
369369 let onBlur = useEvent ( ( e : FocusEvent ) => {
370+ // If the input value is not in the collection, we need to reset the value.
370371 if (
371372 ! props . allowsCustomValue &&
372373 inputRef . current ?. value &&
You can’t perform that action at this time.
0 commit comments