-
Notifications
You must be signed in to change notification settings - Fork 77
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
update(Tooltip): Render Popover's popup in Overlay component #392
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,23 +28,23 @@ export type TooltipProps = { | |
content: NonNullable<React.ReactNode>; | ||
/** True to disable tooltip but still show children. */ | ||
disabled?: boolean; | ||
/** Manually override calculated horizontal align */ | ||
/** Manually override calculated horizontal align. */ | ||
horizontalAlign?: 'center' | 'left' | 'right'; | ||
/** True to use a light background with dark text. */ | ||
inverted?: boolean; | ||
/** Callback fired when the tooltip is closed. */ | ||
onClose?: () => void; | ||
/** Callback fired when the tooltip is shown. */ | ||
onShow?: () => void; | ||
/** True to enable interactive popover functionality */ | ||
/** True to enable interactive popover functionality. */ | ||
popover?: boolean; | ||
/** True to prevent dismissmal on mouse down. */ | ||
remainOnMouseDown?: boolean; | ||
/** True to toggle tooltip display on click. */ | ||
toggleOnClick?: boolean; | ||
/** True to add a dotted bottom border. */ | ||
underlined?: boolean; | ||
/** Manually override calculated vertical align */ | ||
/** Manually override calculated vertical align. */ | ||
verticalAlign?: 'above' | 'below'; | ||
/** Width of the tooltip in units. */ | ||
width?: number; | ||
|
@@ -314,23 +314,17 @@ export class Tooltip extends React.Component<TooltipProps & WithStylesProps, Too | |
marginTop: above ? -(tooltipHeight + targetRect.height + distance) : distance, | ||
textAlign: align, | ||
})} | ||
onMouseEnter={handleMouseEnter} | ||
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. can you elaborate on why this change was needed? Seems fine, wanted to check that the 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.
I can assure this is ok with a gif (hacked in a larger margin so we can see the gif easily).
Yesterday Erik and I ran into a weird case where if the mouse was on the trigger while the popup was opening in the direction the mouse came from, there wouldn't be a continuity between mouse enter trigger -> mouse leave trigger (because of the popup animation) -> mouse entering popup -> mouse leaving popup (when animations passes the cursor) -> mouse back on trigger. Oddly enough, I don't seem to be encountering that today if I move the mouse handlers back down to the content div. But the first screenshot shows margins weren't causing an issue with the current implementation, so I think the handlers should be fine on either div. |
||
onMouseLeave={handleMouseLeave} | ||
> | ||
<div | ||
className={cx(styles.content, invert && styles.content_inverted)} | ||
onMouseEnter={handleMouseEnter} | ||
onMouseLeave={handleMouseLeave} | ||
> | ||
<div className={cx(styles.content, invert && styles.content_inverted)}> | ||
<Text inverted={invert}>{content}</Text> | ||
</div> | ||
</div> | ||
); | ||
|
||
if (popover) { | ||
return open && <div className={cx(styles.popover)}>{popupContent}</div>; | ||
} | ||
|
||
return ( | ||
<Overlay noBackground open={open} onClose={this.handleClose}> | ||
<Overlay noBackground enableMouseInteraction={popover} open={open} onClose={this.handleClose}> | ||
{popupContent} | ||
</Overlay> | ||
); | ||
|
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.
thanks for adding these 😄
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.
np, I said I would in the last PR :)