Skip to content

Commit

Permalink
fix: [TreeSelect] fix when single select, searchable, search box in t…
Browse files Browse the repository at this point in the history
…riger, tooltip of label cannot be triggered to display
  • Loading branch information
YyumeiZhang committed Jun 12, 2024
1 parent 161d475 commit f1b3db2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/semi-foundation/treeSelect/foundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,10 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
this._registerClickOutsideHandler();
}

onClickSearchItem = (e: any) => {
this.focusInput(true);
}

// Scenes that may trigger blur
// 1、clickOutSide
// 2、click option / press enter, and then select complete(when multiple is false
Expand Down
1 change: 1 addition & 0 deletions packages/semi-foundation/treeSelect/treeSelect.scss
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ $module: #{$prefix}-tree-select;

&-placeholder {
opacity: .6;
z-index: -1;
}

&-disabled {
Expand Down
4 changes: 2 additions & 2 deletions packages/semi-ui/treeSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
[`${prefixcls}-selection-TriggerSearchItem-disabled`]: disabled,
});
return (
<span className={spanCls}>
<span className={spanCls} onClick={this.foundation.onClickSearchItem}>
{renderText ? renderText : placeholder}
</span>
);
Expand All @@ -944,8 +944,8 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
const { inputValue } = this.state;
return (
<>
{!inputValue && this.renderSingleTriggerSearchItem()}
{this.renderInput()}
{!inputValue && this.renderSingleTriggerSearchItem()}
</>
);
};
Expand Down

0 comments on commit f1b3db2

Please sign in to comment.