fix[popover]:Popover becomes unanchored when trigger is invisible
- [x] I have followed (at least) the PR section of the contributing guide.
Issue : https://github.com/mui/base-ui/issues/2121
Bundle size report
| Bundle | Parsed Size | Gzip Size |
|---|---|---|
| @base-ui-components/react | 🔺+289B(+0.10%) | 🔺+99B(+0.10%) |
Generated by :no_entry_sign: dangerJS against f65b1174a465772041ea94b787a150ffb5b651fd
Deploy Preview for base-ui ready!
| Name | Link |
|---|---|
| Latest commit | f65b1174a465772041ea94b787a150ffb5b651fd |
| Latest deploy log | https://app.netlify.com/projects/base-ui/deploys/685d581739dd870008027277 |
| Deploy Preview | https://deploy-preview-2166--base-ui.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
This won't work in cases where an ancestor of the trigger becomes hidden. Making this work reliably in all cases is quite tricky and may have a negative impact on performance (especially when observing all ancestors). I'd recommend using the same approach as in #1907 - ignoring it. We can update the docs to say that the popup should be hidden manually whenever the trigger gets hidden. cc @atomiks
This may be more of a feature or extension of the hide() middleware - if the autoUpdate function runs to recalculate the position when the trigger hides, then [data-anchor-hidden] would be applied to the positioner to hide it with CSS (visibility: hidden)