File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
packages/react-aria-components Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ export const NumberField = /*#__PURE__*/ (forwardRef as forwardRefType)(function
127
127
data-disabled = { props . isDisabled || undefined }
128
128
data-required = { props . isRequired || undefined }
129
129
data-invalid = { validation . isInvalid || undefined } />
130
- { props . name && < input type = "hidden" name = { props . name } form = { props . form } value = { isNaN ( state . numberValue ) ? '' : state . numberValue } /> }
130
+ { props . name && < input type = "hidden" name = { props . name } form = { props . form } value = { isNaN ( state . numberValue ) ? '' : state . numberValue } disabled = { props . isDisabled || undefined } /> }
131
131
</ Provider >
132
132
) ;
133
133
} ) ;
Original file line number Diff line number Diff line change @@ -135,6 +135,12 @@ describe('NumberField', () => {
135
135
expect ( input ) . toHaveValue ( '' ) ;
136
136
} ) ;
137
137
138
+ it ( 'should support disabled when having a form value' , ( ) => {
139
+ render ( < TestNumberField isDisabled name = "test" form = "test" value = { 25 } formatOptions = { { style : 'currency' , currency : 'USD' } } /> ) ;
140
+ let input = document . querySelector ( 'input[name=test]' ) ;
141
+ expect ( input ) . toBeDisabled ( ) ;
142
+ } ) ;
143
+
138
144
it ( 'should render data- attributes only on the outer element' , ( ) => {
139
145
let { getAllByTestId} = render (
140
146
< TestNumberField data-testid = "number-field" />
You can’t perform that action at this time.
0 commit comments