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
Fixing combobox menu flipping on initial open #2069
Conversation
// Update position once the ListBox has rendered. This ensures that | ||
// it flips properly when it doesn't fit in the available space. | ||
// TODO: add ResizeObserver to useOverlayPosition so we don't need this. | ||
useLayoutEffect(() => { | ||
if (state.isOpen) { | ||
requestAnimationFrame(() => { | ||
updatePosition(); | ||
}); | ||
} | ||
}, [state.isOpen, updatePosition]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taken straight from Picker. I thought I remembered this bit of code causing problems in the past for ComboBox but I dug through the repo/pulls/issues and couldn't find anything. Seems to work fine in testing
Build successful! 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in chrome/ff/safari
LGTM |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Closes #2024
✅ Pull Request Checklist:
📝 Test Instructions:
In any of the combobox stories, size your window in such a way that the listbox won't fit fully at the bottom. The listbox should be flipped to the top when opened
🧢 Your Project:
RSP