File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
11
11
/* eslint-disable import/no-mutable-exports */
12
12
13
13
import oneOfRequiredProperty from '../../../utilities/warning/one-of-required-property' ;
14
+ import onlyOneOfProperties from '../../../utilities/warning/only-one-of-properties' ;
14
15
15
16
let checkProps = function ( ) { } ;
16
17
@@ -21,6 +22,10 @@ if (process.env.NODE_ENV !== 'production') {
21
22
assistiveText : props . assistiveText ,
22
23
label : props . label
23
24
} ) ;
25
+ onlyOneOfProperties ( COMPONENT , {
26
+ assistiveText : props . assistiveText ,
27
+ label : props . label
28
+ } ) ;
24
29
/* eslint-enable max-len */
25
30
} ;
26
31
}
Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ const Input = React.createClass({
191
191
const hasIcon = iconCategory && iconName ;
192
192
193
193
// One of these is required to pass accessibility tests
194
- const labelText = assistiveText || label ;
194
+ const labelText = label || assistiveText ;
195
195
196
196
return (
197
197
< div
@@ -201,14 +201,19 @@ const Input = React.createClass({
201
201
} ,
202
202
className ) }
203
203
>
204
- { labelText && ( ! readOnly
205
- ? < label className = { classNames ( 'slds-form-element__label' , { 'slds-assistive-text' : assistiveText } ) } htmlFor = { id } >
204
+ { labelText && ( readOnly
205
+ ? < span
206
+ className = { classNames ( 'slds-form-element__label' , { 'slds-assistive-text' : assistiveText && ! label } ) }
207
+ >
208
+ { labelText }
209
+ </ span >
210
+ : < label
211
+ className = { classNames ( 'slds-form-element__label' , { 'slds-assistive-text' : assistiveText && ! label } ) } htmlFor = { id }
212
+ >
206
213
{ required && < abbr className = "slds-required" title = "required" > *</ abbr > }
207
214
{ labelText }
208
215
</ label >
209
- : < span className = { classNames ( 'slds-form-element__label' , { 'slds-assistive-text' : assistiveText } ) } >
210
- { labelText }
211
- </ span > ) }
216
+ ) }
212
217
< div
213
218
className = { classNames ( 'slds-form-element__control' , hasIcon && [
214
219
'slds-input-has-icon' ,
You can’t perform that action at this time.
0 commit comments