Skip to content

Commit

Permalink
fix: [Select] Fixed the problem that when the search panel is opened,…
Browse files Browse the repository at this point in the history
… after the search input loses focus, it cannot be focused again by clicking it
  • Loading branch information
YyumeiZhang committed Jan 10, 2025
1 parent d9e931c commit 34786c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions packages/semi-foundation/select/foundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {

handleClick(e: any) {
const { clickToHide } = this.getProps();
const { isOpen } = this.getStates();
const { isOpen, showInput } = this.getStates();
const isDisabled = this._isDisabled();

if (isDisabled) {
Expand All @@ -350,7 +350,13 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
} else if (isOpen && clickToHide) {
this.close({ event: e });
} else if (isOpen && !clickToHide) {
this.focusInput();
// this.focusInput();
if (showInput) {
this.focusInput();
} else {
this.toggle2SearchInput(true);
}

}
}

Expand Down Expand Up @@ -1118,6 +1124,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
if (filter && !isMultiple ) {
if (showInput || autoFocus) {
this.toggle2SearchInput(false);
this.clearInput();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/semi-ui/select/_story/select.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3709,4 +3709,4 @@ export const fix2465 = () => {
<Button onClick={()=>{multipleSelectBox.current.close()}}>close</Button>
</div>
);
}
}

0 comments on commit 34786c7

Please sign in to comment.