Fix hidden label causing accessibility issue for search inputs (#21275)
* Try unhiding search label. * Use aria-label. Remove label as empty labels are useless. * Remove addition of package-lock.json.gh/stable
parent
4114a7088a
commit
903e5a3f45
|
@ -123,20 +123,18 @@ class Search extends React.PureComponent {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='search'>
|
<div className='search'>
|
||||||
<label>
|
<input
|
||||||
<span style={{ display: 'none' }}>{intl.formatMessage(messages.placeholder)}</span>
|
ref={this.setRef}
|
||||||
<input
|
className='search__input'
|
||||||
ref={this.setRef}
|
type='text'
|
||||||
className='search__input'
|
placeholder={intl.formatMessage(signedIn ? messages.placeholderSignedIn : messages.placeholder)}
|
||||||
type='text'
|
aria-label={intl.formatMessage(signedIn ? messages.placeholderSignedIn : messages.placeholder)}
|
||||||
placeholder={intl.formatMessage(signedIn ? messages.placeholderSignedIn : messages.placeholder)}
|
value={value}
|
||||||
value={value}
|
onChange={this.handleChange}
|
||||||
onChange={this.handleChange}
|
onKeyUp={this.handleKeyUp}
|
||||||
onKeyUp={this.handleKeyUp}
|
onFocus={this.handleFocus}
|
||||||
onFocus={this.handleFocus}
|
onBlur={this.handleBlur}
|
||||||
onBlur={this.handleBlur}
|
/>
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<div role='button' tabIndex='0' className='search__icon' onClick={this.handleClear}>
|
<div role='button' tabIndex='0' className='search__icon' onClick={this.handleClear}>
|
||||||
<Icon id='search' className={hasValue ? '' : 'active'} />
|
<Icon id='search' className={hasValue ? '' : 'active'} />
|
||||||
|
|
Reference in New Issue