浏览代码

fix: tooltip dont't wrap span when trigger is custom, close #919

pointhalo 3 年之前
父节点
当前提交
3c0786c89c
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      packages/semi-ui/tooltip/index.tsx

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

@@ -664,7 +664,10 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
                 }
 
                 children = cloneElement(children as React.ReactElement, { style: childrenStyle });
-                children = this.wrapSpan(children);
+                if (trigger !== 'custom') {
+                    // no need to wrap span when trigger is custom, cause it don't need bind event
+                    children = this.wrapSpan(children);
+                }
                 this.isWrapped = true;
             } else if (!isValidElement(children)) {
                 children = this.wrapSpan(children);