fix: save InPlaceEditor on outside blur - #11342
Conversation
fzaninotto
left a comment
There was a problem hiding this comment.
Thanks, but your change breaks existing functionality. Check the following user story:
http://localhost:9010/?path=/story/ra-ui-materialui-input-inplaceeditor--complex
The 3rd and 4th fields are no longer editable...
Handle MUI portal-based components (e.g. SelectInput dropdowns) that render outside the editor's DOM tree. The blur handler now checks if focus moved to a MUI portal element before triggering a save, preventing premature saves when interacting with Select dropdowns while still saving when focus truly leaves the editor.
19eaa76 to
95dca14
Compare
Thanks for pointing that out! The issue was that components like render their dropdown menu in a Material UI Portal outside the editor's DOM container. The previous blur check was treating the focus shift to the portal dropdown as an outside blur and closing the editor prematurely. I have updated the handleBlur handler to check if focus moves to a MUI portal (.MuiPopover-root, .MuiMenu-root, etc.) and ignore the blur in those cases. The 3rd and 4th fields (select inputs) in the complex story now work as expected while still saving on actual outside blurs. |
Fixes #11303
What I did
Testing