File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
packages/@react-aria/select/src Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -153,13 +153,21 @@ export function HiddenSelect<T>(props: HiddenSelectProps<T>): JSX.Element | null
153
153
} ;
154
154
155
155
if ( validationBehavior === 'native' ) {
156
- // Use a hidden <input type="text"> rather than <input type="hidden">
156
+ // Use a visually hidden <input type="text"> rather than <input type="hidden">
157
157
// so that an empty value blocks HTML form submission when the field is required.
158
- inputProps . type = 'text' ;
159
- inputProps . hidden = true ;
160
- inputProps . required = selectProps . required ;
161
- // Ignore react warning.
162
- inputProps . onChange = ( ) => { } ;
158
+ return (
159
+ < input
160
+ { ...containerProps }
161
+ { ...inputProps }
162
+ type = "text"
163
+ required = { selectProps . required }
164
+ onChange = { ( ) => { /** Ignore react warning. */ } }
165
+ onInvalid = { ( e ) => {
166
+ // Prevent native browser error popup from appearing.
167
+ e . preventDefault ( ) ;
168
+ triggerRef . current ?. focus ( ) ;
169
+ } } />
170
+ ) ;
163
171
}
164
172
165
173
return (
You can’t perform that action at this time.
0 commit comments