File tree Expand file tree Collapse file tree 5 files changed +35
-11
lines changed Expand file tree Collapse file tree 5 files changed +35
-11
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,14 @@ export const Input = memo(
177
177
classes . nativeInputOrTextArea
178
178
) }
179
179
disabled = { disabled || undefined }
180
- aria-describedby = { state !== "default" ? messageId : undefined }
180
+ aria-describedby = {
181
+ [
182
+ state !== "default" ? messageId : undefined ,
183
+ nativeInputOrTextAreaProps [ "aria-describedby" ]
184
+ ]
185
+ . filter ( value => value !== undefined )
186
+ . join ( " " ) || undefined
187
+ }
181
188
type = { textArea ? undefined : nativeInputProps ?. type ?? "text" }
182
189
id = { inputId }
183
190
/>
Original file line number Diff line number Diff line change @@ -104,7 +104,11 @@ export const Select = memo(
104
104
{ ...nativeSelectProps }
105
105
className = { cx ( fr . cx ( "fr-select" ) , nativeSelectProps . className ) }
106
106
id = { selectId }
107
- aria-describedby = { stateDescriptionId }
107
+ aria-describedby = {
108
+ nativeSelectProps [ "aria-describedby" ] !== undefined
109
+ ? `${ stateDescriptionId } ${ nativeSelectProps [ "aria-describedby" ] } `
110
+ : stateDescriptionId
111
+ }
108
112
disabled = { disabled }
109
113
>
110
114
{ children }
Original file line number Diff line number Diff line change @@ -95,8 +95,8 @@ function NonMemoizedNonForwardedSelect<T extends SelectProps.Option[]>(
95
95
className,
96
96
label,
97
97
hint,
98
- nativeSelectProps,
99
- disabled = nativeSelectProps ? .disabled ?? false ,
98
+ nativeSelectProps = { } ,
99
+ disabled = nativeSelectProps . disabled ?? false ,
100
100
options,
101
101
state = "default" ,
102
102
stateRelatedMessage,
@@ -113,7 +113,7 @@ function NonMemoizedNonForwardedSelect<T extends SelectProps.Option[]>(
113
113
} ) ;
114
114
115
115
const { selectId, stateDescriptionId } = ( function useClosure ( ) {
116
- const selectIdExplicitlyProvided = nativeSelectProps ? .id ;
116
+ const selectIdExplicitlyProvided = nativeSelectProps . id ;
117
117
const elementId = useId ( ) ;
118
118
const selectId = selectIdExplicitlyProvided ?? `select-${ elementId } ` ;
119
119
const stateDescriptionId =
@@ -171,9 +171,13 @@ function NonMemoizedNonForwardedSelect<T extends SelectProps.Option[]>(
171
171
} ) ( )
172
172
} ;
173
173
} ) ( ) }
174
- className = { cx ( fr . cx ( "fr-select" ) , nativeSelectProps ? .className ) }
174
+ className = { cx ( fr . cx ( "fr-select" ) , nativeSelectProps . className ) }
175
175
id = { selectId }
176
- aria-describedby = { stateDescriptionId }
176
+ aria-describedby = {
177
+ nativeSelectProps [ "aria-describedby" ] !== undefined
178
+ ? `${ stateDescriptionId } ${ nativeSelectProps [ "aria-describedby" ] } `
179
+ : stateDescriptionId
180
+ }
177
181
disabled = { disabled }
178
182
>
179
183
{ [
Original file line number Diff line number Diff line change @@ -79,7 +79,11 @@ export const Upload = memo(
79
79
</ label >
80
80
) }
81
81
< input
82
- aria-describedby = { messageId }
82
+ aria-describedby = {
83
+ nativeInputProps [ "aria-describedby" ] !== undefined
84
+ ? `${ messageId } ${ nativeInputProps [ "aria-describedby" ] } `
85
+ : messageId
86
+ }
83
87
aria-disabled = { disabled }
84
88
className = { cx ( fr . cx ( "fr-upload" ) ) }
85
89
disabled = { disabled }
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ export const PasswordInput = memo(
60
60
classes = { } ,
61
61
style,
62
62
messages = [ ] ,
63
- nativeInputProps,
63
+ nativeInputProps = { } ,
64
64
messagesHint = t ( "your password must contain" ) ,
65
65
...rest
66
66
} = props ;
@@ -75,7 +75,7 @@ export const PasswordInput = memo(
75
75
const inputId = ( function useClosure ( ) {
76
76
const id = useId ( ) ;
77
77
78
- return nativeInputProps ? .id ?? `password-${ id } ` ;
78
+ return nativeInputProps . id ?? `password-${ id } ` ;
79
79
} ) ( ) ;
80
80
const togglePasswordShowId = `${ inputId } -toggle-show` ;
81
81
const messagesGroupId = `${ inputId } -messages-group` ;
@@ -152,7 +152,12 @@ export const PasswordInput = memo(
152
152
id = { inputId }
153
153
type = { isPasswordReveled ? "text" : "password" }
154
154
disabled = { disabled }
155
- { ...( messages . length !== 0 && { "aria-describedby" : messagesGroupId } ) }
155
+ { ...( messages . length !== 0 && {
156
+ "aria-describedby" :
157
+ nativeInputProps [ "aria-describedby" ] !== undefined
158
+ ? `${ messagesGroupId } ${ nativeInputProps [ "aria-describedby" ] } `
159
+ : messagesGroupId
160
+ } ) }
156
161
/>
157
162
</ div >
158
163
{ messages . length !== 0 && (
You can’t perform that action at this time.
0 commit comments