- Notifications
You must be signed in to change notification settings - Fork4.4k
fix: tooltip position on edge of screen#34518
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:release
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -75,7 +75,13 @@ if (!portalContainer) { | ||||||||||||||||||||||||||||||||||||
| function TooltipComponent(props: TooltipProps) { | ||||||||||||||||||||||||||||||||||||
| const modifiers = useMemo( | ||||||||||||||||||||||||||||||||||||
| () => ({ | ||||||||||||||||||||||||||||||||||||
| preventOverflow: { | ||||||||||||||||||||||||||||||||||||
| enabled: true, | ||||||||||||||||||||||||||||||||||||
| boundariesElement: "viewport", | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| flip: { | ||||||||||||||||||||||||||||||||||||
| enabled: true, | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
Comment on lines +78 to +84 Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Consider Adding Comments for Clarity While the code changes are effective, adding comments explaining why these specific modifiers were chosen could be beneficial for future maintenance. This is especially important as tooltips are a common UI component and these changes might have nuanced impacts on different parts of the application. preventOverflow: {+ // Enable to prevent the tooltip from overflowing the viewport enabled: true,+ // Set the boundary element to the viewport to ensure visibility boundariesElement: "viewport", }, flip: {+ // Enable flipping to adjust tooltip position dynamically enabled: true, },Committable suggestion
Suggested change
| ||||||||||||||||||||||||||||||||||||
| ...props.modifiers, | ||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||
| [props.modifiers], | ||||||||||||||||||||||||||||||||||||