Skip to content

Commit 769f40b

Browse files
authored
Fix tooltip classname space (#1609)
1 parent d600372 commit 769f40b

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

packages/components/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Fixed
1111

1212
- `Select` inside a `Dialog` losing focus after clicking an option
13+
- `Tooltip` adding extra space to its child's `className`
1314

1415
### Changed
1516

packages/components/src/Menu/MenuDisclosure.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const MenuDisclosure: FC<MenuDisclosureProps> = ({
135135
'aria-haspopup': true,
136136
className: `${childProps.className || ''}${
137137
isOpen ? ' active' : ''
138-
} ${tooltipClassName}`,
138+
} ${tooltipClassName}`.trim(),
139139
disabled,
140140
id: `button-${id}`,
141141
ref: triggerCallbackRef,

packages/components/src/Tooltip/Tooltip.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ export const Tooltip: FC<TooltipProps> = ({ children, ...props }) => {
5656
if (isValidElement(children)) {
5757
target = cloneElement(children, {
5858
...domProps,
59-
className: `${children.props.className || ''} ${domProps.className}`,
59+
className:
60+
`${children.props.className || ''} ${domProps.className}`.trim() ||
61+
undefined,
6062
})
6163
} else if (isRenderProp(children)) {
6264
target = children(domProps)

0 commit comments

Comments
 (0)