Skip to content

fix: save InPlaceEditor on outside blur - #11342

Open
Aayush5154 wants to merge 1 commit into
marmelab:masterfrom
Aayush5154:fix/inplace-editor-blur
Open

fix: save InPlaceEditor on outside blur#11342
Aayush5154 wants to merge 1 commit into
marmelab:masterfrom
Aayush5154:fix/inplace-editor-blur

Conversation

@Aayush5154

Copy link
Copy Markdown

Fixes #11303

What I did

  • Fixed InPlaceEditor blur handling when focus moves outside the editor.
  • Added a regression test for saving when focus moves to an external element.

Testing

  • All test suites pass.
  • Manually verified the behavior in Storybook.

@fzaninotto fzaninotto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@Aayush5154
Aayush5154 force-pushed the fix/inplace-editor-blur branch from 19eaa76 to 95dca14 Compare September 2, 2026 18:17
@Aayush5154

Copy link
Copy Markdown
Author

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...

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

InPlaceEditor ignores blur when focus moves outside the editor

2 participants