Skip to content

Commit

Permalink
feat(select-input): clear input value on blur
Browse files Browse the repository at this point in the history
  • Loading branch information
betavs committed Sep 28, 2023
1 parent 3438817 commit 781b89b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/select-input/useMultiple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export default function useMultiple(props: TdSelectInputProps) {
onFocus={(val, context) => {
props.onFocus?.(props.value, { ...context, tagInputValue: val });
}}
onBlur={() => {
setTInputValue('');
}}
{...props.tagInputProps}
inputProps={{
readonly: !props.allowInput || props.readonly,
Expand Down
3 changes: 3 additions & 0 deletions src/select-input/useSingle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export default function useSingle(props: TdSelectInputProps) {
// focus might not need to change input value. it will caught some curious errors in tree-select
// !popupVisible && setInputValue(getInputValue(value, keys), { ...context, trigger: 'input' });
}}
onBlur={() => {
setInputValue('');
}}
onEnter={(val, context) => {
props.onEnter?.(value, { ...context, inputValue: val });
}}
Expand Down

0 comments on commit 781b89b

Please sign in to comment.