Skip to content

Commit

Permalink
fix(comp:select): call blur after 'enter' envent (#1441)
Browse files Browse the repository at this point in the history
  • Loading branch information
danranVm committed Feb 13, 2023
1 parent 7829ca1 commit 391c526
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/components/select/src/Select.tsx
Expand Up @@ -87,6 +87,7 @@ export default defineComponent({
handleRemove,
clearInput,
setOverlayOpened,
blur,
)

watch(overlayOpened, opened => {
Expand Down
Expand Up @@ -20,6 +20,7 @@ export function useKeyboardEvents(
handleRemove: (key: VKey) => void,
clearInput: () => void,
setOverlayOpened: (opened: boolean) => void,
blur: () => void | undefined,
): (evt: KeyboardEvent) => void {
return (evt: KeyboardEvent) => {
switch (evt.code) {
Expand All @@ -36,7 +37,10 @@ export function useKeyboardEvents(
const key = activeValue.value
!isNil(key) && changeSelected(key)
clearInput()
!isMultiple.value && setOverlayOpened(false)
if (!isMultiple.value) {
setOverlayOpened(false)
blur()
}
break
}
case 'Backspace': {
Expand Down

0 comments on commit 391c526

Please sign in to comment.