about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/compose/components/search.js
diff options
context:
space:
mode:
authorAlex Stine <alex.stine@yourtechadvisors.com>2022-12-15 09:20:21 -0600
committerGitHub <noreply@github.com>2022-12-15 16:20:21 +0100
commit903e5a3f459d28b093438dc4827b2fb976aef406 (patch)
treefd598cbb9fdc625148a826a51a55052a97be6ddc /app/javascript/mastodon/features/compose/components/search.js
parent4114a7088a7161a8aebf27d20433c0f47a4f178c (diff)
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.
Diffstat (limited to 'app/javascript/mastodon/features/compose/components/search.js')
-rw-r--r--app/javascript/mastodon/features/compose/components/search.js26
1 files changed, 12 insertions, 14 deletions
diff --git a/app/javascript/mastodon/features/compose/components/search.js b/app/javascript/mastodon/features/compose/components/search.js
index ebb23d92f..03e6dcf2c 100644
--- a/app/javascript/mastodon/features/compose/components/search.js
+++ b/app/javascript/mastodon/features/compose/components/search.js
@@ -123,20 +123,18 @@ class Search extends React.PureComponent {
 
     return (
       <div className='search'>
-        <label>
-          <span style={{ display: 'none' }}>{intl.formatMessage(messages.placeholder)}</span>
-          <input
-            ref={this.setRef}
-            className='search__input'
-            type='text'
-            placeholder={intl.formatMessage(signedIn ? messages.placeholderSignedIn : messages.placeholder)}
-            value={value}
-            onChange={this.handleChange}
-            onKeyUp={this.handleKeyUp}
-            onFocus={this.handleFocus}
-            onBlur={this.handleBlur}
-          />
-        </label>
+        <input
+          ref={this.setRef}
+          className='search__input'
+          type='text'
+          placeholder={intl.formatMessage(signedIn ? messages.placeholderSignedIn : messages.placeholder)}
+          aria-label={intl.formatMessage(signedIn ? messages.placeholderSignedIn : messages.placeholder)}
+          value={value}
+          onChange={this.handleChange}
+          onKeyUp={this.handleKeyUp}
+          onFocus={this.handleFocus}
+          onBlur={this.handleBlur}
+        />
 
         <div role='button' tabIndex='0' className='search__icon' onClick={this.handleClear}>
           <Icon id='search' className={hasValue ? '' : 'active'} />