diff --git a/projects/packages/forms/changelog/fix-forms-other-option-label-reset b/projects/packages/forms/changelog/fix-forms-other-option-label-reset new file mode 100644 index 00000000000..7e800f017fd --- /dev/null +++ b/projects/packages/forms/changelog/fix-forms-other-option-label-reset @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Fix "Other" option toggle not updating the option label in the editor diff --git a/projects/packages/forms/src/blocks/option/edit.js b/projects/packages/forms/src/blocks/option/edit.js index 080b7c1489c..4341daf637d 100644 --- a/projects/packages/forms/src/blocks/option/edit.js +++ b/projects/packages/forms/src/blocks/option/edit.js @@ -151,7 +151,12 @@ const OptionEdit = ( { setAttributes( { isOther: value } ) } + onChange={ value => + setAttributes( { + isOther: value, + label: value ? '' : label, + } ) + } help={ __( 'Show as "Other" option with a text input field below it.', 'jetpack-forms' @@ -169,7 +174,7 @@ const OptionEdit = ( { tagName="div" className="wp-block" value={ labelValue } - placeholder={ __( 'Add option…', 'jetpack-forms' ) } + placeholder={ placeholderValue } __unstableDisableFormats onChange={ newLabel => setAttributes( { label: newLabel } ) } onMerge={ mergeBlocks }