mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 09:26:06 +08:00
fix(checkbox): disabled checkbox should works well with tooltip (#33772)
Co-authored-by: wanghao <wanghao.wong@bytedance.com>
This commit is contained in:
parent
3c76de74ce
commit
6dd39c1f89
@ -122,6 +122,7 @@
|
|||||||
|
|
||||||
.@{checkbox-prefix-cls}-input {
|
.@{checkbox-prefix-cls}-input {
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.@{checkbox-inner-prefix-cls} {
|
.@{checkbox-inner-prefix-cls} {
|
||||||
|
@ -16,32 +16,6 @@ exports[`Tooltip should hide when mouse leave antd disabled component Button 1`]
|
|||||||
</span>
|
</span>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`Tooltip should hide when mouse leave antd disabled component Checkbox 1`] = `
|
|
||||||
<span
|
|
||||||
class="ant-tooltip-disabled-compatible-wrapper"
|
|
||||||
style="display: inline-block; cursor: not-allowed;"
|
|
||||||
>
|
|
||||||
<label
|
|
||||||
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled"
|
|
||||||
style="pointer-events: none;"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="ant-checkbox ant-checkbox-disabled"
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
class="ant-checkbox-input"
|
|
||||||
disabled=""
|
|
||||||
type="checkbox"
|
|
||||||
value=""
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
class="ant-checkbox-inner"
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
</span>
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`Tooltip should hide when mouse leave antd disabled component Switch 1`] = `
|
exports[`Tooltip should hide when mouse leave antd disabled component Switch 1`] = `
|
||||||
<span
|
<span
|
||||||
class="ant-tooltip-disabled-compatible-wrapper"
|
class="ant-tooltip-disabled-compatible-wrapper"
|
||||||
|
@ -4,7 +4,6 @@ import { spyElementPrototype } from 'rc-util/lib/test/domHook';
|
|||||||
import Tooltip from '..';
|
import Tooltip from '..';
|
||||||
import Button from '../../button';
|
import Button from '../../button';
|
||||||
import Switch from '../../switch';
|
import Switch from '../../switch';
|
||||||
import Checkbox from '../../checkbox';
|
|
||||||
import DatePicker from '../../date-picker';
|
import DatePicker from '../../date-picker';
|
||||||
import Input from '../../input';
|
import Input from '../../input';
|
||||||
import Group from '../../input/Group';
|
import Group from '../../input/Group';
|
||||||
@ -131,7 +130,6 @@ describe('Tooltip', () => {
|
|||||||
|
|
||||||
testComponent('Button', Button);
|
testComponent('Button', Button);
|
||||||
testComponent('Switch', Switch);
|
testComponent('Switch', Switch);
|
||||||
testComponent('Checkbox', Checkbox);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render disabled Button style properly', () => {
|
it('should render disabled Button style properly', () => {
|
||||||
|
@ -87,7 +87,6 @@ function getDisabledCompatibleChildren(element: React.ReactElement<any>, prefixC
|
|||||||
if (
|
if (
|
||||||
(elementType.__ANT_BUTTON === true ||
|
(elementType.__ANT_BUTTON === true ||
|
||||||
elementType.__ANT_SWITCH === true ||
|
elementType.__ANT_SWITCH === true ||
|
||||||
elementType.__ANT_CHECKBOX === true ||
|
|
||||||
element.type === 'button') &&
|
element.type === 'button') &&
|
||||||
element.props.disabled
|
element.props.disabled
|
||||||
) {
|
) {
|
||||||
@ -130,9 +129,11 @@ function getDisabledCompatibleChildren(element: React.ReactElement<any>, prefixC
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Tooltip = React.forwardRef<unknown, TooltipProps>((props, ref) => {
|
const Tooltip = React.forwardRef<unknown, TooltipProps>((props, ref) => {
|
||||||
const { getPopupContainer: getContextPopupContainer, getPrefixCls, direction } = React.useContext(
|
const {
|
||||||
ConfigContext,
|
getPopupContainer: getContextPopupContainer,
|
||||||
);
|
getPrefixCls,
|
||||||
|
direction,
|
||||||
|
} = React.useContext(ConfigContext);
|
||||||
|
|
||||||
const [visible, setVisible] = useMergedState(false, {
|
const [visible, setVisible] = useMergedState(false, {
|
||||||
value: props.visible,
|
value: props.visible,
|
||||||
|
Loading…
Reference in New Issue
Block a user