-
Notifications
You must be signed in to change notification settings - Fork 5k
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 tooltip positioning and closing in mobile #12423
Conversation
WalkthroughThe update to the Changes
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
✅ Deploy Preview for ethereumorg ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (1)
- src/components/Tooltip/index.tsx (2 hunks)
Additional comments: 3
src/components/Tooltip/index.tsx (3)
- 1-9: The import of
useDisclosure
from Chakra UI is correctly implemented and aligns with the PR's objective to enhance state management for the tooltip's visibility. This change leverages Chakra UI's built-in functionality for a more standardized approach.- 39-44: The integration of
isOpen
,onOpen
, andonClose
fromuseDisclosure
into thePopover
component's props is correctly done, ensuring that the tooltip's visibility is managed effectively. This change supports the PR's goal of improving the tooltip's behavior on mobile devices.- 39-44: While the removal of the
strategy
prop from thePopover
component is not directly visible in the provided code, it's mentioned in the PR's objectives and AI-generated summary. Assuming this change was made as part of the PR, it's important to ensure that the default positioning behavior of thePopover
component aligns with the intended user experience across all platforms, especially on mobile devices where screen real estate is limited.Please verify that the default positioning behavior of the
Popover
component without thestrategy
prop meets the intended design and usability goals on all platforms, particularly on mobile devices.
src/components/Tooltip/index.tsx
Outdated
if (isOpen) { | ||
onClose() | ||
} |
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.
Consider a guard clause
if (isOpen) { | |
onClose() | |
} | |
if (!isOpen) return | |
onClose() |
...or we could consider removing the check all together, but I think this is good
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- src/components/Tooltip/index.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/components/Tooltip/index.tsx
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.
Looks great! Thanks @pettinarip!
if (isOpen && Math.abs(delta) > 80) { | ||
onClose() | ||
} |
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.
This works great! I like that it doesn't close from the slightest nudge... it feels natural
Summary by CodeRabbit
Tooltip
component's behavior on mobile devices by automatically closing it upon scrolling.