File tree 2 files changed +13
-2
lines changed
packages/mui-material/src/Radio
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ const Radio = React.forwardRef(function Radio(inProps, ref) {
127
127
disableRipple = false ,
128
128
slots = { } ,
129
129
slotProps = { } ,
130
+ inputProps,
130
131
...other
131
132
} = props ;
132
133
@@ -166,6 +167,8 @@ const Radio = React.forwardRef(function Radio(inProps, ref) {
166
167
}
167
168
}
168
169
170
+ const externalInputProps = slotProps . input ?? inputProps ;
171
+
169
172
const [ RootSlot , rootSlotProps ] = useSlot ( 'root' , {
170
173
ref,
171
174
elementType : RadioRoot ,
@@ -197,7 +200,9 @@ const Radio = React.forwardRef(function Radio(inProps, ref) {
197
200
slotProps : {
198
201
// Do not forward `slotProps.root` again because it's already handled by the `RootSlot` in this file.
199
202
input :
200
- typeof slotProps . input === 'function' ? slotProps . input ( ownerState ) : slotProps . input ,
203
+ typeof externalInputProps === 'function'
204
+ ? externalInputProps ( ownerState )
205
+ : externalInputProps ,
201
206
} ,
202
207
} ,
203
208
} ) ;
Original file line number Diff line number Diff line change 1
1
import * as React from 'react' ;
2
2
import { expect } from 'chai' ;
3
- import { createRenderer } from '@mui/internal-test-utils' ;
3
+ import { createRenderer , screen } from '@mui/internal-test-utils' ;
4
4
import Radio , { radioClasses as classes } from '@mui/material/Radio' ;
5
5
import FormControl from '@mui/material/FormControl' ;
6
6
import ButtonBase from '@mui/material/ButtonBase' ;
@@ -142,4 +142,10 @@ describe('<Radio />', () => {
142
142
} ) ;
143
143
} ) ;
144
144
} ) ;
145
+
146
+ it ( 'deprecated `inputProps` should work' , ( ) => {
147
+ render ( < Radio inputProps = { { 'aria-label' : 'A' } } /> ) ;
148
+
149
+ expect ( screen . queryByRole ( 'radio' , { name : 'A' } ) ) . not . to . equal ( null ) ;
150
+ } ) ;
145
151
} ) ;
You can’t perform that action at this time.
0 commit comments