Skip to content

Commit 4c432a3

Browse files
committed
[Doc] Explain openOnFocus in <AutocompleteInput> with StrictMode
1 parent d806d88 commit 4c432a3

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

docs/AutocompleteArrayInput.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ const CreateRole = () => {
212212
```
213213
{% endraw %}
214214

215+
**Tip**: In development with `React.StrictMode`, you may run into an issue where the `<AutocompleteInput>` menu reopens after clicking the create item when the [`openOnFocus`](https://mui.com/material-ui/api/autocomplete/#autocomplete-prop-openOnFocus) prop is set to `true` which is the default with React-admin. If that bothers you, set the `openOnFocus` prop to `false`.
216+
215217
If you just need to ask users for a single string to create the new option, you can use [the `onCreate` prop](#oncreate) instead.
216218

217219
If you're in a `<ReferenceArrayInput>` or `<ReferenceManyToManyInput>`, the `handleSubmit` will need to create a new record in the related resource. Check the [Creating New Choices](#creating-new-choices) for an example.

docs/AutocompleteInput.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ const CreateCategory = () => {
219219
```
220220
{% endraw %}
221221

222+
**Tip**: In development with `React.StrictMode`, you may run into an issue where the `<AutocompleteInput>` menu reopens after clicking the create item when the [`openOnFocus`](https://mui.com/material-ui/api/autocomplete/#autocomplete-prop-openOnFocus) prop is set to `true` which is the default with React-admin. If that bothers you, set the `openOnFocus` prop to `false`.
223+
222224
If you want to customize the label of the "Create XXX" option, use [the `createItemLabel` prop](#createitemlabel).
223225

224226
If you just need to ask users for a single string to create the new option, you can use [the `onCreate` prop](#oncreate) instead.

0 commit comments

Comments
 (0)