From f697559497bae86e96b8047b06def1d9c2c58b28 Mon Sep 17 00:00:00 2001 From: saranshsinhaa Date: Fri, 20 Mar 2026 01:14:57 +0530 Subject: [PATCH] Fix: Fit text toggle disappears when turned off --- packages/block-editor/src/hooks/fit-text.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/block-editor/src/hooks/fit-text.js b/packages/block-editor/src/hooks/fit-text.js index 91089eaaef2fc9..1890379e7e6053 100644 --- a/packages/block-editor/src/hooks/fit-text.js +++ b/packages/block-editor/src/hooks/fit-text.js @@ -243,7 +243,7 @@ function useFitText( { fitText, name, clientId } ) { */ export function FitTextControl( { clientId, - fitText = false, + fitText, setAttributes, name, fontSize, @@ -256,7 +256,7 @@ export function FitTextControl( { return ( fitText } + hasValue={ () => fitText === true || fitText === false } label={ __( 'Fit text' ) } onDeselect={ () => setAttributes( { fitText: undefined } ) } resetAllFilter={ () => ( { fitText: undefined } ) } @@ -264,9 +264,9 @@ export function FitTextControl( { > { - const newFitText = ! fitText || undefined; + const newFitText = fitText ? false : true; const updates = { fitText: newFitText }; // When enabling fit text, clear font size if it has a value @@ -288,7 +288,7 @@ export function FitTextControl( { setAttributes( updates ); } } help={ - fitText + fitText === true ? __( 'Text will resize to fit its container.' ) : __( 'The text will resize to fit its container, resetting other font size settings.'