Browse Source

fix: collapse tabs click inner portal sometimes did not work (#1364)

* fix: collapse tabs click inner portal sometimes did not work

* fix: collapse tabs click inner portal sometimes did not work
YannLynn 2 years ago
parent
commit
76f2e7ef07
2 changed files with 2 additions and 1 deletions
  1. 1 0
      packages/semi-ui/tabs/TabBar.tsx
  2. 1 1
      packages/semi-ui/tooltip/index.tsx

+ 1 - 0
packages/semi-ui/tabs/TabBar.tsx

@@ -201,6 +201,7 @@ class TabBar extends React.Component<TabBarProps, TabBarState> {
                 showTick
                 style={dropdownStyle}
                 trigger={'hover'}
+                disableFocusListener // prevent the panel from popping up again after clicking
             >
                 <div role="presentation" className={arrowCls} onClick={(e): void => this.handleArrowClick(items, pos)}>
                     <Button

+ 1 - 1
packages/semi-ui/tooltip/index.tsx

@@ -340,7 +340,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
                     popupEl = ReactDOM.findDOMNode(popupEl as React.ReactInstance) as HTMLDivElement;
                     if (
                         (el && !(el as any).contains(e.target) && popupEl && !(popupEl as any).contains(e.target)) ||
-                        this.props.clickTriggerToHide
+                        (this.props.clickTriggerToHide && el && (el as any).contains(e.target))
                     ) {
                         this.props.onClickOutSide(e);
                         cb();