react-admin
react-admin copied to clipboard
AutocompleteArrayInput disableCloseOnSelect prop not respected
What you were expecting:
AutocompleteArrayInput should not close after selection when disableCloseOnSelect is true.
What happened instead:
It closes after each selection.
Steps to reproduce:
Related code:
Codesandbox (Categories field on create post form)
Other information:
Environment
- React-admin version: 4.1.2
- Last version that did not exhibit the issue (if applicable):
- React version: 18.1
- Browser:
- Stack trace (in case of a JS error):
Thanks for the report. Bug spotted!
The reason is because blurOnSelect is enabled by default.
Setting both disableCloseOnSelect and blurOnSelect={false} fixes this.
https://codesandbox.io/s/playground-demo-material-ui-forked-wjnm0d?file=/demo.js
Indeed, the mui documentation should at least stipulate that the two props cannot coexist. An issue has been opened.
Meanwhile as MathiasDierickx points out, adding blurOnSelect={false} to the AutocompleteArrayInput fixes the problem