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

Select multiple popup menu moves when items are selected #20707

Closed
2 tasks done
mboyers opened this issue Apr 23, 2020 · 5 comments
Closed
2 tasks done

Select multiple popup menu moves when items are selected #20707

mboyers opened this issue Apr 23, 2020 · 5 comments
Labels
component: select This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists
Milestone

Comments

@mboyers
Copy link

mboyers commented Apr 23, 2020

I noticed this when upgrading from Material UI 4.2.0 to 4.9.10, but through troubleshooting, I believe this behavior started with version 4.8.3.

When using a Select with the multiple attribute, the popup menu moves to a different location upon selection of the first item.

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

When using a Select with the multiple attribute, the popup menu moves upon selection of the first item. I have other examples where it moves several times as multiple items are selected, but in the example I'm providing below, it seems to just move when choosing the first item.

Expected Behavior 🤔

Prior to Material UI v4.8.3, when I would select items from the popup menu, it would remain in its original position and not move around on me.

Steps to Reproduce 🕹

Here's a codesandbox demonstrating the issue.

Steps:

  1. Choose 'Carlos Abbott', for example, the popup repositions itself to a different location, shifting itself up.

Here's a codesandbox with the same code, but using Material UI v4.8.2. I this case, when selecting items, the popup menu stays in its original position and does not move around. I feel like this should be the preferred behavior, but have not figured out what I can apply to the Select or MenuItems to get back to the old behavior.

The codesandboxes were made from samples found in the official Material UI examples.

Context 🔦

In its current state, I feel like I have to chase the menu around when selecting multiple items. As I said above, in this example, the popup only seems to move on the first selection, but I have other situations where it moves several times.

Your Environment 🌎

Tech Version
Material-UI v4.9.10
React v16.12.0
Browser Chrome Version 80.0.3987.163 (Official Build) (64-bit), also behaves this way in Firefox 72.0.2 (64-bit)
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: select This is the name of the generic UI component, not the React module! labels Apr 23, 2020
@oliviertassinari
Copy link
Member

We plan to remove the getContentAnchorEl feature in v5, it should get us this bug for free.

@oliviertassinari
Copy link
Member

A temporary workaround

        <Select
          MenuProps={{
            getContentAnchorEl: () => null,
          }}

@oliviertassinari oliviertassinari added this to the v5 milestone Apr 23, 2020
@tpeek
Copy link

tpeek commented Apr 25, 2020

If it helps, looks like this is the PR that caused this bug: #19046

Overriding getContentAnchorEl seems to prevent the Menu from repositioning itself at all, even after closing and reopening it. Is the old behavior no longer supported?

@efkan
Copy link

efkan commented Apr 28, 2020

duplicate issue #19245

@oliviertassinari oliviertassinari added duplicate This issue or pull request already exists and removed bug 🐛 Something doesn't work labels Apr 28, 2020
@oliviertassinari
Copy link
Member

Duplicate of #19245

@oliviertassinari oliviertassinari marked this as a duplicate of #19245 Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: select This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants