Skip to content

Conversation

LukasTy
Copy link
Member

@LukasTy LukasTy commented Jul 28, 2025

Recreate #10847 with a global solution.

Fixes a bug where MUI datepickers would not accept keyboard interaction when loaded in a popup via React Portal. See bug reproduction code here: https://codesandbox.io/s/mui-datepickers-in-popup-window-via-react-portal-dx83lg?file=/src/App.js:0-3486

Instead of using the global document, instead use the inputRef.current's ownerDocument which accurately reflects the document the input is mounted on. This should have no effect to the "normal" usecase, as then inputRef.current.ownerDocument === document


Updated CodeSandbox showcasing problems with the input and accessible DOM structure behaviors as well as a Date Range Picker.

Before

Screen.Recording.2025-07-29.at.10.13.58.mov

After

Screen.Recording.2025-07-29.at.10.19.39.mov

@LukasTy LukasTy self-assigned this Jul 28, 2025
@LukasTy LukasTy added type: bug It doesn't behave as expected. scope: pickers Changes related to the date/time pickers. labels Jul 28, 2025
@mui-bot
Copy link

mui-bot commented Jul 28, 2025

Deploy preview: https://deploy-preview-18944--material-ui-x.netlify.app/

Bundle size report

Bundle Parsed Size Gzip Size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid/DataGrid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro/DataGridPro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium/DataGridPremium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 🔺+61B(+0.03%) 🔺+26B(+0.04%)
@mui/x-date-pickers-pro 🔺+86B(+0.03%) 🔺+34B(+0.04%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against d8ba9f0

@LukasTy LukasTy requested a review from a team July 29, 2025 07:22
Copy link
Member

@flaviendelangle flaviendelangle left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of it 👌

@LukasTy LukasTy merged commit ad6ae40 into mui:master Jul 29, 2025
26 checks passed
@LukasTy LukasTy deleted the fix-field-focus-different-document branch July 29, 2025 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: pickers Changes related to the date/time pickers. type: bug It doesn't behave as expected.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants