feat(popover): added control for closing popover on scroll
Closes #3594
📝 Description
Added a new control shouldCloseOnScroll (default true) to control the closing of popover on scroll.
⛳️ Current behavior (updates)
https://github.com/user-attachments/assets/900796c9-806e-46da-99a9-c63d6ccb1458
🚀 New behavior
https://github.com/user-attachments/assets/1a4e872e-8c38-4f84-b8b6-9736c1554f49
💣 Is this a breaking change (Yes/No): NO
📝 Additional Information
Summary by CodeRabbit
-
New Features
- Introduced a new property to control popover behavior on scroll, enhancing user experience in dynamic interfaces.
- Updated default behavior of the popover to block scrolling outside of it by default.
-
Bug Fixes
- Updated test cases to clarify popover closing behavior based on the
shouldCloseOnScrollproperty.
- Updated test cases to clarify popover closing behavior based on the
🦋 Changeset detected
Latest commit: 04fb65981b1d723878b76070b0893fcdc8f2b5ba
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 6 packages
| Name | Type |
|---|---|
| @nextui-org/popover | Minor |
| @nextui-org/autocomplete | Patch |
| @nextui-org/date-picker | Patch |
| @nextui-org/dropdown | Patch |
| @nextui-org/select | Patch |
| @nextui-org/react | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
@awesome-pro is attempting to deploy a commit to the NextUI Inc Team on Vercel.
A member of the Team first needs to authorize it.
Walkthrough
This update enhances the @nextui-org/popover package by introducing a new feature that allows developers to determine if a popover should automatically close on page scroll. By adding the shouldCloseOnScroll property, developers can customize popover behavior, improving interaction in dynamic interfaces where user engagement is high. This flexibility addresses user feedback regarding unexpected popover behavior during scrolling.
Changes
| Files | Change Summary |
|---|---|
packages/components/popover/src/use-aria-popover.ts, packages/components/popover/src/use-popover.ts, packages/components/popover/stories/popover.stories.tsx |
Added shouldCloseOnScroll property to control popover closure on scroll. Updated function signatures and stories accordingly. |
packages/components/popover/__tests__/popover.test.tsx |
Updated test case to clarify popover closure behavior based on the shouldCloseOnScroll prop. |
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
| Popover should remain open during scroll (#[3594]) | ✅ | |
| Ensure configurable behavior for popover closing | ✅ |
Possibly related PRs
- #3414: This PR directly addresses the behavior of the popover closing on scroll, which is a key feature introduced in the main PR with the
shouldCloseOnScrolloption. - #2854: This PR modifies focus behavior in popovers, which is related to the overall interaction model of popovers, including how they respond to user actions like scrolling.
- #3137: This PR includes updates to focus behavior and interactions with popovers, which aligns with the enhancements made in the main PR regarding popover visibility and user interactions.
- #3311: This PR enhances focus behavior in popovers, which is relevant to the changes made in the main PR that improve user interaction with popovers.
- #3788: This PR ensures that the autocomplete dropdown remains open after clicking the clear button, which relates to the overall behavior of popovers and dropdowns in terms of user interaction and visibility.
Suggested reviewers
- jrgarciadev
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| nextui-storybook-v2 | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Aug 3, 2024 7:48am |
Thank you! @awesome-pro