@@ -124,30 +124,6 @@ export const ImageInput = ({
124
124
'aria-describedby' : descriptionId ,
125
125
...props
126
126
} : ImageInputProps ) => {
127
- if (
128
- process . env . NODE_ENV !== 'production' &&
129
- process . env . NODE_ENV !== 'test'
130
- ) {
131
- if ( ! isSufficientlyLabelled ( label ) ) {
132
- throw new AccessibilityError (
133
- 'ImageInput' ,
134
- 'The `label` prop is missing or invalid.' ,
135
- ) ;
136
- }
137
- if ( ! isSufficientlyLabelled ( clearButtonLabel ) ) {
138
- throw new AccessibilityError (
139
- 'ImageInput' ,
140
- 'The `clearButtonLabel` prop is missing or invalid.' ,
141
- ) ;
142
- }
143
- if ( ! isSufficientlyLabelled ( loadingLabel ) ) {
144
- throw new AccessibilityError (
145
- 'ImageInput' ,
146
- 'The `loadingLabel` prop is missing or invalid.' ,
147
- ) ;
148
- }
149
- }
150
-
151
127
const inputRef = useRef < HTMLInputElement > ( null ) ;
152
128
const id = useId ( ) ;
153
129
const inputId = customId || id ;
@@ -242,6 +218,30 @@ export const ImageInput = ({
242
218
}
243
219
} ;
244
220
221
+ if (
222
+ process . env . NODE_ENV !== 'production' &&
223
+ process . env . NODE_ENV !== 'test'
224
+ ) {
225
+ if ( ! isSufficientlyLabelled ( label ) ) {
226
+ throw new AccessibilityError (
227
+ 'ImageInput' ,
228
+ 'The `label` prop is missing or invalid.' ,
229
+ ) ;
230
+ }
231
+ if ( ! isSufficientlyLabelled ( clearButtonLabel ) ) {
232
+ throw new AccessibilityError (
233
+ 'ImageInput' ,
234
+ 'The `clearButtonLabel` prop is missing or invalid.' ,
235
+ ) ;
236
+ }
237
+ if ( ! isSufficientlyLabelled ( loadingLabel ) ) {
238
+ throw new AccessibilityError (
239
+ 'ImageInput' ,
240
+ 'The `loadingLabel` prop is missing or invalid.' ,
241
+ ) ;
242
+ }
243
+ }
244
+
245
245
return (
246
246
< FieldWrapper className = { className } style = { style } disabled = { disabled } >
247
247
< FieldLabelText
0 commit comments