Skip to content
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

[pickers] Too much recursion error when using MobileDatePicker inside a IonModal component #13556

Closed
m-zaharieva opened this issue Jun 19, 2024 · 5 comments
Labels
component: pickers This is the name of the generic UI component, not the React module! external dependency Blocked by external dependency, we can’t do anything about it mobile Targets mobile platform status: waiting for author Issue with insufficient information

Comments

@m-zaharieva
Copy link

m-zaharieva commented Jun 19, 2024

Steps to reproduce

Link to live example: (required)
I have created this repository, reproducing the problem I am facing:
https://github.com/m-zaharieva/mui-mobile-date-picker-issue
Steps:

  1. Install the npm packages by "npm install" command.
  2. "npm run dev" to run the project locally.
  3. Click on the white bordered input at the top left corner, to open the mobile date picker and select a random date.

Current behavior

the console shows multiple errors:
Uncaught InternalError: too much recursion
focusLastDescendant overlays.js:124
trapShadowFocus overlays.js:271 ....

2024-06-19-18-21-24

Expected behavior

To select the clicked date with no errors on the console.

Context

I am developing a mobile application with ionic, react and MUI. I have a form, inside a modal, that has a field for month picking.
But @mui Mobile Date Picker inside Modal is causing an too much recursion. I tested it outside the modal component and it does not have this behavior.

Your environment

npx @mui/envinfo
  FireFox - 126.0.1 (64-bit)
  System:
    OS: Windows 10 10.0.19045
  Binaries:
    Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.1.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: Not Found
  Browsers:
    Chrome: Not Found
    Edge: Chromium (126.0.2592.61)

Search keywords: mobiledatepicker, ionic, react, recursion error,

Search keywords:

@m-zaharieva m-zaharieva added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 19, 2024
@mnajdova mnajdova transferred this issue from mui/material-ui Jun 20, 2024
@michelengelen
Copy link
Member

@LukasTy I am not sure if we can do something about this. For some reason ionic seems to manually sets focus on an element. Wouldn't that be an issue with iconic then?

@michelengelen michelengelen changed the title [mobile date picket] Too much recursion error when using MobileDatePicker inside a IonModal component [pickers][MobileDatePicker] Too much recursion error when using MobileDatePicker inside a IonModal component Jun 20, 2024
@michelengelen michelengelen added component: pickers This is the name of the generic UI component, not the React module! mobile Targets mobile platform labels Jun 20, 2024
@DanailH
Copy link
Member

DanailH commented Jul 11, 2024

@LukasTy Are we still triaging this issue?

@michelengelen
Copy link
Member

I'll add it to the board for now

@michelengelen michelengelen added bug 🐛 Something doesn't work and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jul 16, 2024
@LukasTy LukasTy changed the title [pickers][MobileDatePicker] Too much recursion error when using MobileDatePicker inside a IonModal component [pickers] Too much recursion error when using MobileDatePicker inside a IonModal component Jul 19, 2024
@LukasTy
Copy link
Member

LukasTy commented Jul 19, 2024

Hello @m-zaharieva.
I'm not familiar with Ionic and their components, but it seems to be doing some focus management of its own that might be interfering with FocusTrap behavior from @mui/material.
Could you please try providing the following slotProps and see if that doesn't negatively impact your behavior?
Check this documentation for more information about it.

slotProps={{
  dialog: {
    disableEnforceFocus: true,
  }
}}

P.S. You are defining your textField slot inline, this might produce unnecessary remounting of the component, please check the recommended usage documentation and consider doing the necessary changes.

All the changes I've done:

  • Extract inline textField component outside of Tab1 into CustomTextField
  • Apply the following changes:
    slots={{
      textField: CustomTextField,
    }}
    slotProps={{
      textField: {
        errors,
      },
      dialog: {
        disableEnforceFocus: true,
      }
    }}

Does it help you solve the problem? 🤔

@LukasTy LukasTy added status: waiting for author Issue with insufficient information external dependency Blocked by external dependency, we can’t do anything about it and removed bug 🐛 Something doesn't work labels Jul 19, 2024
Copy link

The issue has been inactive for 7 days and has been automatically closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! external dependency Blocked by external dependency, we can’t do anything about it mobile Targets mobile platform status: waiting for author Issue with insufficient information
Projects
None yet
Development

No branches or pull requests

4 participants