Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ if (!portalContainer) {
function TooltipComponent(props: TooltipProps) {
const modifiers = useMemo(
() => ({
preventOverflow: { enabled: false },
preventOverflow: {
enabled: true,
boundariesElement: "viewport",
},
flip: {
enabled: true,
},
Comment on lines +78 to +84
Copy link
Contributor

Choose a reason for hiding this comment

The 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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
preventOverflow: {
enabled: true,
boundariesElement: "viewport",
},
flip: {
enabled: true,
},
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,
},

...props.modifiers,
}),
[props.modifiers],
Expand Down