Skip to content

Commit

Permalink
Don't show tooltip in zoom out toggle button when showIconLabels is t…
Browse files Browse the repository at this point in the history
…rue (#65573)

Co-authored-by: t-hamano <[email protected]>
Co-authored-by: afercia <[email protected]>
Co-authored-by: draganescu <[email protected]>
  • Loading branch information
4 people authored and gutenbergplugin committed Sep 24, 2024
1 parent 44e4896 commit 360c6c8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/editor/src/components/zoom-out-toggle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@ import { __ } from '@wordpress/i18n';
import { useDispatch, useSelect } from '@wordpress/data';
import { store as blockEditorStore } from '@wordpress/block-editor';
import { square as zoomOutIcon } from '@wordpress/icons';
import { store as preferencesStore } from '@wordpress/preferences';

/**
* Internal dependencies
*/
import { unlock } from '../../lock-unlock';

const ZoomOutToggle = () => {
const { isZoomOut } = useSelect( ( select ) => ( {
const { isZoomOut, showIconLabels } = useSelect( ( select ) => ( {
isZoomOut: unlock( select( blockEditorStore ) ).isZoomOut(),
showIconLabels: select( preferencesStore ).get(
'core',
'showIconLabels'
),
} ) );

const { resetZoomLevel, setZoomLevel, __unstableSetEditorMode } = unlock(
Expand All @@ -38,6 +43,7 @@ const ZoomOutToggle = () => {
label={ __( 'Toggle Zoom Out' ) }
isPressed={ isZoomOut }
size="compact"
showTooltip={ ! showIconLabels }
/>
);
};
Expand Down

0 comments on commit 360c6c8

Please sign in to comment.