Browse Source

Fix a bug of Tooltip won't disappear in Chrome

when there are two wrapper of Tooltip/Popover/Popconfirm

close #13001
pull/13003/head
afc163 6 years ago
parent
commit
f8e074812c
  1. 13
      components/tooltip/index.tsx

13
components/tooltip/index.tsx

@ -122,23 +122,12 @@ class Tooltip extends React.Component<TooltipProps, any> {
});
}
isHoverTrigger() {
const { trigger } = this.props;
if (!trigger || trigger === 'hover') {
return true;
}
if (Array.isArray(trigger)) {
return trigger.indexOf('hover') >= 0;
}
return false;
}
// Fix Tooltip won't hide at disabled button
// mouse events don't trigger at disabled button in Chrome
// https://github.com/react-component/tooltip/issues/18
getDisabledCompatibleChildren(element: React.ReactElement<any>) {
if (((element.type as typeof Button).__ANT_BUTTON || element.type === 'button') &&
element.props.disabled && this.isHoverTrigger()) {
element.props.disabled) {
// Pick some layout related style properties up to span
// Prevent layout bugs like https://github.com/ant-design/ant-design/issues/5254
const { picked, omitted } = splitObject(

Loading…
Cancel
Save