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

Fixing combobox menu flipping on initial open #2069

Merged
merged 7 commits into from Jul 21, 2021
Merged

Fixing combobox menu flipping on initial open #2069

merged 7 commits into from Jul 21, 2021

Conversation

LFDanLu
Copy link
Member

@LFDanLu LFDanLu commented Jun 29, 2021

Closes #2024

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 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

Comment on lines +140 to +149
// 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]);
Copy link
Member Author

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

@adobe-bot
Copy link

Build successful! 🎉

Copy link
Member

@snowystinger snowystinger left a 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

@reidbarber
Copy link
Member

LGTM

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@LFDanLu LFDanLu added the small review Easy to review PR label Jul 20, 2021
@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@LFDanLu LFDanLu merged commit f886178 into main Jul 21, 2021
@LFDanLu LFDanLu deleted the issue_2024 branch July 21, 2021 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
small review Easy to review PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ComboBox - Menu direction does not flip correctly
6 participants