Skip to content

Commit 22abe42

Browse files
im3dabasiaim3dabasiaMamadukat-hamano
authored andcommitted
Components: Fix label and placeholder handling in LinkControlSearchInput (WordPress#70096)
Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org>
1 parent 35026b3 commit 22abe42

File tree

7 files changed

+64
-55
lines changed

7 files changed

+64
-55
lines changed

packages/block-editor/src/components/link-control/search-input.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,23 @@ const LinkControlSearchInput = forwardRef(
114114
}
115115
};
116116

117+
const _placeholder = placeholder ?? __( 'Search or type URL' );
118+
119+
const label =
120+
hideLabelFromVision && placeholder !== ''
121+
? _placeholder
122+
: __( 'Link' );
123+
117124
return (
118125
<div className="block-editor-link-control__search-input-container">
119126
<URLInput
120127
disableSuggestions={ currentLink?.url === value }
121-
label={ __( 'Link' ) }
128+
label={ label }
122129
hideLabelFromVision={ hideLabelFromVision }
123130
className={ className }
124131
value={ value }
125132
onChange={ onInputChange }
126-
placeholder={ placeholder ?? __( 'Search or type URL' ) }
133+
placeholder={ _placeholder }
127134
__experimentalRenderSuggestions={
128135
showSuggestions ? handleRenderSuggestions : null
129136
}

0 commit comments

Comments
 (0)