-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[data grid] Autocomplete edit cell requires 2 clicks to exit edit mode #5506
Comments
Although it's rendered in a Portal we consider it as a click inside the row. Only the 2nd click triggers the exit from the edit mode. I'm not sure if I understand correctly what you want to achieve. If you want to exit from the edit mode as soon as an option is selected, you can follow https://mui.com/x/react-data-grid/editing/#with-auto-stop We don't ship the built-in components with this behavior because it doesn't work with validation.
You can listen to |
@m4theushw thank you for your reply. What I'm trying to achieve is making the "end of edit mode" consistent across cells. I don't want to exit as soon as the user selects an option, since he may want to tab to other cells. In summary, I want the autocomplete cell to behave exactly the same as other cells, where clicking once outside of the row or tabbing out of the row will commit and exit edit mode. |
Thanks for providing the recording. If you remove the |
Yes, any call to
Check the CodeSandbox I added in #5506 (comment) The ideal way to disable Enter is using |
That will disable the "Enter to commit" behavior all together which is not what I need. |
Please check if https://codesandbox.io/s/fullfeaturedcrudgrid-demo-mui-x-forked-r3j7h4?file=/demo.tsx works. The idea is to disable the default behavior of Enter, then manually call |
It worked! |
Order ID 💳
28950
Duplicates
Latest version
The problem in depth 🔍
With a grid in row edit mode and a cell with the autocomplete component, it takes two clicks to exit the edit mode and commit those changes.
How to reproduce:
3a) if the user changes the "Name" cell and clicks once outside of the grid, it commits and goes into view mode
3b) if the user changes the "Country" cell, it takes two clicks outside the grid in order to commit and set it to view mode.
In the example above, removing the following lines resolves the click issue, but creates another problem for keyboard users where on pressing Enter to select an option it will automatically commit and exit edit mode.
onClose={(ev) => { ev.preventDefault(); ev.stopPropagation(); }}
Your environment 🌎
`npx @mui/envinfo`
The text was updated successfully, but these errors were encountered: