Skip to content

Commit

Permalink
Merge fdb2dae into 390511e
Browse files Browse the repository at this point in the history
  • Loading branch information
broccolinisoup authored Jun 27, 2024
2 parents 390511e + fdb2dae commit d7b5688
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion packages/react/src/ActionBar/ActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export const ActionBarIconButton = forwardRef((props: ActionBarIconButtonProps,
const domRect = (ref as MutableRefObject<HTMLElement>).current.getBoundingClientRect()
setChildrenWidth({text, width: domRect.width})
}, [ref, setChildrenWidth])
return <IconButton ref={ref} size={size} {...props} variant="invisible" unsafeDisableTooltip={false} />
return <IconButton ref={ref} size={size} {...props} variant="invisible" />
})

const sizeToHeight = {
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/ActionList/TrailingAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const TrailingAction = forwardRef(({as = 'button', icon, label, href = nu
aria-label={label}
icon={icon}
variant="invisible"
unsafeDisableTooltip={false}
tooltipDirection="w"
href={href}
// @ts-expect-error StyledButton wants both Anchor and Button refs
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Button/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const IconButton = forwardRef(
disabled,
tooltipDirection,
// This is planned to be a temporary prop until the default tooltip on icon buttons are fully rolled out.
unsafeDisableTooltip = true,
unsafeDisableTooltip = false,
...props
},
forwardedRef,
Expand Down
9 changes: 5 additions & 4 deletions packages/react/src/Button/__tests__/Button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ describe('Button', () => {
const tooltipEl = getByText('Love is all around')
expect(triggerEL).toHaveAttribute('aria-describedby', tooltipEl.id)
})
it('should not render tooltip on an icon button by default', () => {
const {getByRole} = render(<IconButton icon={HeartIcon} aria-label="Heart" />)
it('should render tooltip on an icon button by default', () => {
const {getByRole, getByText} = render(<IconButton icon={HeartIcon} aria-label="Heart" />)
const triggerEl = getByRole('button')
expect(triggerEl).not.toHaveAttribute('aria-labelledby')
expect(triggerEl).toHaveAttribute('aria-label', 'Heart')
const tooltipEl = getByText('Heart')
expect(triggerEl).toHaveAttribute('aria-labelledby', tooltipEl.id)
expect(triggerEl).not.toHaveAttribute('aria-label')
})
})
2 changes: 2 additions & 0 deletions packages/react/src/drafts/MarkdownEditor/_ToolbarButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export const ToolbarButton = forwardRef<HTMLButtonElement, IconButtonProps>((pro
onMouseDown={(e: React.MouseEvent) => e.preventDefault()}
{...props}
sx={{color: 'fg.muted', ...props.sx}}
// Keeping the tooltip disable since it is not maintained anymore and its tests were failing.
unsafeDisableTooltip
/>
)
})
Expand Down
32 changes: 15 additions & 17 deletions packages/react/src/drafts/SelectPanel2/SelectPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
IconButton,
Heading,
Box,
Tooltip,
TextInput,
Spinner,
Text,
Expand Down Expand Up @@ -401,15 +400,13 @@ const SelectPanelHeader: React.FC<React.PropsWithChildren & {onBack?: () => void
>
<Box sx={{display: 'flex'}}>
{onBack ? (
<Tooltip text="Back" direction="s">
<IconButton
type="button"
variant="invisible"
icon={ArrowLeftIcon}
aria-label="Back"
onClick={() => onBack()}
/>
</Tooltip>
<IconButton
type="button"
variant="invisible"
icon={ArrowLeftIcon}
aria-label="Back"
onClick={() => onBack()}
/>
) : null}

<Box sx={{marginLeft: onBack ? 1 : 2, marginTop: description ? '2px' : 0}}>
Expand All @@ -428,15 +425,16 @@ const SelectPanelHeader: React.FC<React.PropsWithChildren & {onBack?: () => void
</Box>

<Box>
{/* Will not need tooltip after https://github.com/primer/react/issues/2008 */}
{onClearSelection ? (
<Tooltip text="Clear selection" direction="s" onClick={onClearSelection}>
<IconButton type="button" variant="invisible" icon={FilterRemoveIcon} aria-label="Clear selection" />
</Tooltip>
<IconButton
type="button"
variant="invisible"
icon={FilterRemoveIcon}
aria-label="Clear selection"
onClick={onClearSelection}
/>
) : null}
<Tooltip text="Close" direction="s">
<IconButton type="button" variant="invisible" icon={XIcon} aria-label="Close" onClick={() => onCancel()} />
</Tooltip>
<IconButton type="button" variant="invisible" icon={XIcon} aria-label="Close" onClick={() => onCancel()} />
</Box>
</Box>

Expand Down

0 comments on commit d7b5688

Please sign in to comment.