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

fix: Don't close popovers on scroll #7541

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jabrks
Copy link

@jabrks jabrks commented Dec 20, 2024

Closes #7516.

This addresses a regression introduced in #7368 within the usePopover hook

✅ 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:

I've added a new Jest test for this

🧢 Your Project:

@jabrks jabrks closed this Dec 20, 2024
@jabrks jabrks reopened this Dec 20, 2024
}

describe('usePopover', () => {
it('should not add scroll listener', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for the PR.

This test is very much about the implementation details. Could we make it more about how a user would interact with it and come across this in real life? That way if we change how this is implemented down the line, we won't break the test and we'll know we haven't broken the intended behavior.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree completely. As mentioned in the description, I struggled with finding something appropriate to assert on here. I will take another look and see if I can come up with something better

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I think I've landed on something more robust this time around

@jabrks jabrks changed the title fix: Don't add scroll listener to popovers fix: Don't close popovers on scroll Dec 23, 2024
Copy link
Member

@reidbarber reidbarber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Playwright tests fail when choosing option in select beyond initial viewport
3 participants