Skip to content
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

Components: Remove unnecessary Tooltip component from linked button #68498

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from
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
@@ -1,22 +1,20 @@
/**
* WordPress dependencies
*/
import { Button, Tooltip } from '@wordpress/components';
import { Button } from '@wordpress/components';
import { link, linkOff } from '@wordpress/icons';
import { __ } from '@wordpress/i18n';

export default function LinkedButton( { isLinked, ...props } ) {
const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );

return (
<Tooltip text={ label }>
<Button
{ ...props }
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
aria-label={ label }
/>
</Tooltip>
<Button
{ ...props }
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
label={ label }
/>
);
}
2 changes: 2 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@

## Unreleased

- `BorderBoxControl`, `BoxControl`: Remove `Tooltip` component from linked button ([#68498](https://github.com/WordPress/gutenberg/pull/68498)).

## 29.2.0 (2025-01-15)

### Internal
Original file line number Diff line number Diff line change
@@ -8,8 +8,6 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import Button from '../../button';
import Tooltip from '../../tooltip';
import { View } from '../../view';
import type { WordPressComponentProps } from '../../context';
import { contextConnect } from '../../context';
import { useBorderBoxControlLinkedButton } from './hook';
@@ -25,18 +23,15 @@ const BorderBoxControlLinkedButton = (
const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );

return (
<Tooltip text={ label }>
<View className={ className }>
<Button
{ ...buttonProps }
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
aria-label={ label }
ref={ forwardedRef }
/>
</View>
</Tooltip>
<Button
{ ...buttonProps }
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
label={ label }
ref={ forwardedRef }
className={ className }
/>
);
};

19 changes: 8 additions & 11 deletions packages/components/src/box-control/linked-button.tsx
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import Button from '../button';
import Tooltip from '../tooltip';

export default function LinkedButton( {
isLinked,
@@ -17,15 +16,13 @@ export default function LinkedButton( {
const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );

return (
<Tooltip text={ label }>
<Button
{ ...props }
className="component-box-control__linked-button"
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
aria-label={ label }
/>
</Tooltip>
<Button
{ ...props }
className="component-box-control__linked-button"
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
label={ label }
/>
);
}