mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 06:03:38 +08:00
fix(Button): button's children should be disabled when button is disabled (#42949)
* fix: button's children should be disabled when button is disabled * feat: update test case * feat: update test case
This commit is contained in:
parent
0e520f730a
commit
f0a94139e7
@ -334,4 +334,13 @@ describe('Button', () => {
|
||||
);
|
||||
expect(wrapper.container.firstChild).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("should prevent children's event when button is disabled", () => {
|
||||
const { container } = render(
|
||||
<Button disabled>
|
||||
<a id="link">test</a>
|
||||
</Button>,
|
||||
);
|
||||
expect(window.getComputedStyle(container.querySelector('#link')!).pointerEvents).toBe('none');
|
||||
});
|
||||
});
|
||||
|
@ -38,6 +38,10 @@ const genSharedButtonStyle: GenerateStyle<ButtonToken, CSSObject> = (token): CSS
|
||||
lineHeight: token.lineHeight,
|
||||
color: token.colorText,
|
||||
|
||||
'&:disabled > *': {
|
||||
pointerEvents: 'none',
|
||||
},
|
||||
|
||||
'> span': {
|
||||
display: 'inline-block',
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user