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

[Popper] The anchorEl prop provided to the component is invalid #60

Closed
2 tasks done
IAluI opened this issue Dec 26, 2023 · 3 comments
Closed
2 tasks done

[Popper] The anchorEl prop provided to the component is invalid #60

IAluI opened this issue Dec 26, 2023 · 3 comments
Labels
bug 🐛 Something doesn't work out of scope The problem looks valid but we won't fix it (maybe we will revisit it in the future)

Comments

@IAluI
Copy link

IAluI commented Dec 26, 2023

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example: https://codesandbox.io/p/sandbox/date-component-h3rd46
Video illustrating the problem: https://drive.google.com/file/d/1o4sQGAuk3N2cRw6t4o44PlE4p_hUdb23/view?usp=sharing

The example above uses a MuixTimePicker (it uses the popper component internally) to implement a date input into an AgGrid table column filter. If you click on a part of the page that is not related to either the column menu or the calendar, the calendar will jump to the upper left corner of the screen before being closed.

Current behavior 😯

Popper component (hereinafter MuiBasePopper) have useEffect witch call forceUpdate method of PopperJS instance on every time after MuiPopperBase was rendered. This behavior sometimes leads to undesirable results. In my case, the problem arises because it is not possible to correctly determine the position of the anchorEl when MuiPopperBase closing.

Expected behavior 🤔

It would be nice if forceUpdate method of PopperJS instance do not called in cases where correct updating position is not possible. Or would be some way to control this through props.

Context 🔦

When embedding MuiPopperBase and dependent components into third party libraries, we don't always have full control over the rendering process. I understand that the sudden removal of the anchorEl from the DOM is an emergency situation. But it would be nice if MuiPopperBase to handle it more gently.

The closest issue I could find.

Your environment 🌎

npx @mui/envinfo
System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
Binaries:
  Node: 20.5.1 - ~/.nvm/versions/node/v20.5.1/bin/node
  Yarn: Not Found
  npm: 9.8.0 - ~/.nvm/versions/node/v20.5.1/bin/npm
Browsers:
  Chrome: 120.0.6099.129
npmPackages:
  @emotion/react: 11.11.3 => 11.11.3 
  @emotion/styled: 11.11.0 => 11.11.0 
  @mui/base:  5.0.0-beta.16 
  @mui/core-downloads-tracker:  5.15.1 
  @mui/icons-material: 5.14.9 => 5.14.9 
  @mui/lab: 5.0.0-alpha.145 => 5.0.0-alpha.145 
  @mui/material: 5.15.1 => 5.15.1 
  @mui/private-theming:  5.15.1 
  @mui/styled-engine:  5.15.1 
  @mui/system:  5.15.1 
  @mui/types:  7.2.11 
  @mui/utils:  5.15.1 
  @mui/x-date-pickers: 6.18.6 => 6.18.6 
  @mui/x-tree-view: 6.0.0-alpha.4 => 6.0.0-alpha.4 
  @types/react:  18.2.20 
  react: 18.2.0 => 18.2.0 
  react-dom: 18.2.0 => 18.2.0 
  typescript:  5.1.6
tsconfig
{
    "compilerOptions": {
        "allowSyntheticDefaultImports": true,
        "baseUrl": "./",
        "experimentalDecorators": true,
        "jsx": "react-jsx",
        "module": "esnext",
        "moduleResolution": "node",
        "paths": {
            "@/*": ["./src/*"],
            "assets": ["./public"],
            "sprite": ["./src/images/icons"]
        },
        "resolveJsonModule": true,
        "strict": true,
        "strictFunctionTypes": false,
        "strictNullChecks": true,
        "target": "esnext"
    },
    "exclude": ["node_modules", "**/*.spec.ts"]
}
@IAluI IAluI added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 26, 2023
@mnajdova mnajdova assigned michaldudak and unassigned mnajdova Dec 26, 2023
@michaldudak michaldudak transferred this issue from mui/material-ui Feb 27, 2024
@michaldudak michaldudak changed the title [base-ui][Popper] The anchorEl prop provided to the component is invalid [Popper] The anchorEl prop provided to the component is invalid Feb 27, 2024
@michaldudak michaldudak added the bug 🐛 Something doesn't work label Feb 27, 2024
@michaldudak
Copy link
Member

We are not going to include Popper in future versions of Base UI. We will use Floating UI under the hood for all components that contain popups.

@michaldudak michaldudak closed this as not planned Won't fix, can't repro, duplicate, stale Apr 19, 2024
@michaldudak michaldudak added out of scope The problem looks valid but we won't fix it (maybe we will revisit it in the future) and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Apr 19, 2024
@michaldudak michaldudak removed their assignment Apr 19, 2024
@karamws
Copy link

karamws commented Aug 8, 2024

I have same problem but with dynamic form, with DatePicker.
any workaround?

@IAluI
Copy link
Author

IAluI commented Aug 16, 2024

@karamws If your "dynamic form" is a parent React component, then it's probably not the same problem. One way or another, you can provide custom Popper component via slot props ({ popper: YoursFixedPopper }). You can use a copy of Popper component as a basis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work out of scope The problem looks valid but we won't fix it (maybe we will revisit it in the future)
Projects
None yet
Development

No branches or pull requests

4 participants