Popover doesn't reposition when content changes
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
If Popover's content changes after it has been open, popover will not reposition itself to not overflow the page
- 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 😯
Popover doen't change position, can overflow
Expected Behavior 🤔
Popover changes position, doesn't overflow
Steps to Reproduce 🕹
https://codesandbox.io/s/popover-doesnt-obvesrve-changes-properly-iprcx?file=/content.js
Steps:
- Open sandbox
- click on the button
- wait 1 second
- see that bottom part of the popover overflows the page
Context 🔦
My use case:
Hint button should display a small table of items, that are fetched from backend after click.
After items are fetched, table obviosly grows and no longer fits.
Additionally, hint button happens to be positioned near the right border of the screen, so resulting table oveflows the page horizontaly too.
Note that moving the content out of it's own component will fix the problem as change will force the whole Popover to re-render, but I cannot do that in a real application because content is it's own component and used 4 more times outside of popover.
Your Environment 🌎
`npx @mui/envinfo`
System: OS: Windows 10 10.0.19043 Binaries: Node: 16.8.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.11 - ~\AppData\Roaming\npm\yarn.CMD npm: 7.21.0 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: Not Found Edge: Spartan (44.19041.1023.0), Chromium (93.0.961.47) npmPackages: @mui/core: 5.0.0-alpha.47 @mui/icons-material: ^5.0.0 => 5.0.0 @mui/lab: ^5.0.0-alpha.47 => 5.0.0-alpha.47 @mui/material: ^5.0.0 => 5.0.0 @mui/private-theming: 5.0.0 @mui/styled-engine-sc: ^5.0.0 => 5.0.0 @mui/styles: ^5.0.0 => 5.0.0 @mui/system: 5.0.0 @mui/types: 7.0.0 @mui/utils: 5.0.0 @types/react: ^17.0.21 => 17.0.21 react: ^17.0.2 => 17.0.2 react-dom: ^17.0.2 => 17.0.2 styled-components: ^5.3.1 => 5.3.1 typescript: ^4.4.3 => 4.4.3Chrome 96.0.4645.0
FIrefox 93.0b5 (64-bit)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox reproduction and the Popover component entry point; verify the delayed content growth after opening and the resulting overflow. Trace how Popover responds to content-size changes, then add coverage for the reproduced behavior and confirm that the popover repositions without requiring content to move components.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100