Skip to content

Commit 3136814

Browse files
authored
Forms: fix phone field controls overlap (#45764)
* changelog * wrap toggle control with base control for proper rendering, change control index * use toggle help instead of basecontrol help for hint * wee copy change
1 parent 0adf900 commit 3136814

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
Forms: fix phone field extra controls option to append to shared field controls

projects/packages/forms/src/blocks/field-telephone/edit.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ import {
44
BlockContextProvider,
55
BlockControls,
66
} from '@wordpress/block-editor';
7-
import { TextControl, ToggleControl, ToolbarButton, ToolbarGroup } from '@wordpress/components';
7+
import {
8+
BaseControl,
9+
TextControl,
10+
ToggleControl,
11+
ToolbarButton,
12+
ToolbarGroup,
13+
} from '@wordpress/components';
814
import { useCallback, useEffect, useMemo, useState } from '@wordpress/element';
915
import { __ } from '@wordpress/i18n';
1016
import { globe } from '@wordpress/icons';
@@ -143,9 +149,9 @@ export default function PhoneFieldEdit( props ) {
143149
width={ width }
144150
extraFieldSettings={ [
145151
{
146-
index: 1,
152+
index: 2,
147153
element: (
148-
<div key="phoneFieldControls">
154+
<BaseControl __nextHasNoMarginBottom={ true } key="phoneFieldControls">
149155
<ToggleControl
150156
label={ __( 'Show country selector', 'jetpack-forms' ) }
151157
checked={ showCountrySelector || false }
@@ -160,9 +166,13 @@ export default function PhoneFieldEdit( props ) {
160166
onChange={ newValue => setAttributes( { searchPlaceholder: newValue } ) }
161167
__nextHasNoMarginBottom={ true }
162168
__next40pxDefaultSize={ true }
169+
help={ __(
170+
'Set placeholder text shown in the country selector search.',
171+
'jetpack-forms'
172+
) }
163173
/>
164174
) }
165-
</div>
175+
</BaseControl>
166176
),
167177
},
168178
] }

0 commit comments

Comments
 (0)