-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Popover not changing position when triggerRef contents change #6383
Comments
Maybe we can add the same react-spectrum/packages/@react-aria/overlays/src/useOverlayPosition.ts Lines 189 to 193 in 5cacbdb
I did a quick test locally, and it seems to work fine (not sure about the full ramifications of adding it though) Screen.Recording.2024-05-15.at.11.39.35.PM.mov |
@sookmax That is what MutationObserver was intended to be used for, and I'm frankly surprised this doesn't already handle elements changing. If we're worried about performance, make it an optional prop. I managed to trigger a reposition myself by toggling the Additionally, there should be a way to manually reposition the popover via context or something. |
Thank you @sookmax , I don't see an issue adding the |
I encountered a similar problem where the popover wouldn't reposition itself when the parent element changed position. As suggested by @eranimo I worked around this by toggling |
Provide a general summary of the issue here
When using Popover by itself with triggerRef, if the bounding box of the trigger changes the popover position does not change.
🤔 Expected Behavior?
The popover should automatically reposition to always be placed correctly when the triggerRef changes
😯 Current Behavior
It does not change position.
💁 Possible Solution
There should be a way to manually trigger a reposition. MutationObserver should be used if it's not already.
🔦 Context
No response
🖥️ Steps to Reproduce
https://codesandbox.io/p/sandbox/polished-sun-g6c9lh?file=%2Fsrc%2FApp.js%3A31%2C25
Version
Using React-Aria-Components 1.2.0
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
Mac OSX
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: