Skip to content

Commit 9ec5765

Browse files
committed
Explain the event.preventDefault
1 parent b69ae09 commit 9ec5765

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/ra-ui-materialui/src/input/AutocompleteInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ If you provided a React element for the optionText prop, you must also provide t
554554

555555
const handleAutocompleteChange = useCallback(
556556
(event: any, newValue: any, reason: AutocompleteChangeReason) => {
557-
event.stopPropagation();
557+
// This prevents auto-submitting a form inside a dialog passed to the `create` prop
558558
event.preventDefault();
559559
if (reason === 'createOption') {
560560
// When users press the enter key after typing a new value, we can handle it as if they clicked on the create option

0 commit comments

Comments
 (0)