Skip to content

Commit

Permalink
[@mantine/core] Tooltip: Remove extra markup from disabled Tooltip.Fl…
Browse files Browse the repository at this point in the history
…oating (#2220)
  • Loading branch information
rtivital committed Aug 27, 2022
1 parent 42098c2 commit ae47009
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/mantine-core/src/Tooltip/Tooltip.story.tsx
Expand Up @@ -51,7 +51,7 @@ export const Controlled = () => {

export const Floating = () => (
<div style={{ padding: 0 }}>
<Tooltip.Floating label="Tooltip" disabled>
<Tooltip.Floating label="Tooltip">
<button type="button" style={{ width: 200, height: 200 }}>
target
</button>
Expand Down
Expand Up @@ -71,6 +71,10 @@ export function TooltipFloating(props: TooltipFloatingProps) {
setOpened(false);
};

if (disabled) {
return <>{children}</>;
}

return (
<>
<OptionalPortal withinPortal={withinPortal}>
Expand All @@ -81,7 +85,7 @@ export function TooltipFloating(props: TooltipFloatingProps) {
style={{
...style,
zIndex,
display: opened && !disabled ? 'block' : 'none',
display: opened ? 'block' : 'none',
top: y ?? '',
left: Math.round(x) ?? '',
}}
Expand Down

0 comments on commit ae47009

Please sign in to comment.