mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-05 23:46:28 +08:00
fix: inconsistency between checkbox and radio in table when Form is disabled (#40728)
This commit is contained in:
parent
41d9efd29f
commit
910d0fc340
@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import Radio, { Button, Group } from '..';
|
||||
import Form from '../../form';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
import rtlTest from '../../../tests/shared/rtlTest';
|
||||
@ -33,4 +34,15 @@ describe('Radio', () => {
|
||||
fireEvent.mouseLeave(container.querySelector('label')!);
|
||||
expect(onMouseLeave).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should use own disabled status first', () => {
|
||||
const { container } = render(
|
||||
<Form disabled>
|
||||
<Radio disabled={false} />
|
||||
</Form>,
|
||||
);
|
||||
expect(container.querySelector('.ant-radio-wrapper')).not.toHaveClass(
|
||||
'ant-radio-wrapper-disabled',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -49,7 +49,7 @@ const InternalRadio: React.ForwardRefRenderFunction<HTMLElement, RadioProps> = (
|
||||
|
||||
// ===================== Disabled =====================
|
||||
const disabled = React.useContext(DisabledContext);
|
||||
radioProps.disabled = customDisabled || disabled;
|
||||
radioProps.disabled = customDisabled ?? disabled;
|
||||
|
||||
if (groupContext) {
|
||||
radioProps.name = groupContext.name;
|
||||
|
Loading…
Reference in New Issue
Block a user