react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

AutocompleteArrayInput disableCloseOnSelect prop not respected

Open nerixim opened this issue 2 years ago • 2 comments

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):

nerixim avatar Jun 07 '22 14:06 nerixim

Thanks for the report. Bug spotted!

antoinefricker avatar Jun 07 '22 15:06 antoinefricker

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

MathiasDierickx avatar Jun 29 '22 12:06 MathiasDierickx

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

arimet avatar Aug 22 '22 16:08 arimet