a11y: Add labels to input fields for screenreader

See: https://dequeuniversity.com/rules/axe/2.1/label
master
Frederic Hemberger 8 years ago
parent d991869498
commit 5ff2762fcf
  1. 1
      app/assets/javascripts/components/features/ui/components/compose_form.jsx
  2. 2
      app/assets/javascripts/components/features/ui/components/follow_form.jsx

@ -132,6 +132,7 @@ const ComposeForm = React.createClass({
const inputProps = { const inputProps = {
placeholder: 'What is on your mind?', placeholder: 'What is on your mind?',
ariaLabel: 'What is on your mind?',
value: this.props.text, value: this.props.text,
onKeyUp: this.handleKeyUp, onKeyUp: this.handleKeyUp,
onChange: this.handleChange, onChange: this.handleChange,

@ -33,7 +33,7 @@ const FollowForm = React.createClass({
render () { render () {
return ( return (
<div style={{ display: 'flex', lineHeight: '20px', padding: '10px', background: '#373b4a' }}> <div style={{ display: 'flex', lineHeight: '20px', padding: '10px', background: '#373b4a' }}>
<input autoComplete='off' type='text' disabled={this.props.is_submitting} placeholder='username@domain' value={this.props.text} onKeyUp={this.handleKeyUp} onChange={this.handleChange} className='follow-form__input' style={{ flex: '1 1 auto', boxSizing: 'border-box', display: 'block', border: 'none', padding: '10px', fontFamily: 'Roboto', color: '#282c37', fontSize: '14px', margin: '0' }} /> <input autoComplete='off' type='text' disabled={this.props.is_submitting} placeholder='username@domain' ariaLabel='Search for username@domain to follow this user' value={this.props.text} onKeyUp={this.handleKeyUp} onChange={this.handleChange} className='follow-form__input' style={{ flex: '1 1 auto', boxSizing: 'border-box', display: 'block', border: 'none', padding: '10px', fontFamily: 'Roboto', color: '#282c37', fontSize: '14px', margin: '0' }} />
<div style={{ padding: '10px', paddingRight: '0' }}><IconButton title='Follow' size={20} icon='user-plus' onClick={this.handleSubmit} disabled={this.props.is_submitting} /></div> <div style={{ padding: '10px', paddingRight: '0' }}><IconButton title='Follow' size={20} icon='user-plus' onClick={this.handleSubmit} disabled={this.props.is_submitting} /></div>
</div> </div>
); );

Loading…
Cancel
Save