Skip to content

Commit

Permalink
feat(dynamic-tags): fix abnormal behavior when using keyboard to trig…
Browse files Browse the repository at this point in the history
…ger add button (#5080)

Co-authored-by: 07akioni <[email protected]>
  • Loading branch information
XieZongChen and 07akioni authored Dec 19, 2023
1 parent 655231d commit 64a91c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Fix `n-carousel` trigger incorrect `current-index` value on arrow button click with single image, closes [#5130](https://github.com/tusen-ai/naive-ui/issues/5130).
- Fix `n-input` autofill's default background color, closes [#5123](https://github.com/tusen-ai/naive-ui/issues/5123).
- Fix `n-upload-trigger` in directory drag mode with a lot of files, some of the files are not read.
- Fix `n-dynamic-tags`'s abnormal behavior when using keyboard to trigger add button, closes [#5077](https://github.com/tusen-ai/naive-ui/issues/5077).

### Features

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- 修复 `n-carousel` 在只有一张图片时点击箭头切换按钮触发的 `current-index` 值不正确,关闭 [#5130](https://github.com/tusen-ai/naive-ui/issues/5130)
- 修复 `n-input` 自动填充时的默认背景色,关闭 [#5123](https://github.com/tusen-ai/naive-ui/issues/5123)
- 修复 `n-upload-trigger` 在拖拽文件夹场景下当文件夹内文件较多时,部分文件不会被正确读取的问题
- 修复 `n-dynamic-tags` 使用键盘触发新增时行为异常,关闭 [#5077](https://github.com/tusen-ai/naive-ui/issues/5077)

### Features

Expand Down
8 changes: 4 additions & 4 deletions src/dynamic-tags/src/DynamicTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default defineComponent({
tags.splice(index, 1)
doChange(tags)
}
function handleInputKeyUp (e: KeyboardEvent): void {
function handleInputKeyDown (e: KeyboardEvent): void {
switch (e.key) {
case 'Enter':
handleInputConfirm()
Expand Down Expand Up @@ -193,7 +193,7 @@ export default defineComponent({
mergedValue: mergedValueRef,
mergedDisabled: mergedDisabledRef,
triggerDisabled: triggerDisabledRef,
handleInputKeyUp,
handleInputKeyDown,
handleAddClick,
handleInputBlur,
handleCloseClick,
Expand Down Expand Up @@ -235,7 +235,7 @@ export default defineComponent({
inputSize,
inputForceFocused,
triggerDisabled,
handleInputKeyUp,
handleInputKeyDown,
handleInputBlur,
handleAddClick,
handleCloseClick,
Expand Down Expand Up @@ -291,7 +291,7 @@ export default defineComponent({
}}
theme={mergedTheme.peers.Input}
themeOverrides={mergedTheme.peerOverrides.Input}
onKeyup={handleInputKeyUp}
onKeydown={handleInputKeyDown}
onBlur={handleInputBlur}
internalForceFocus={inputForceFocused}
/>
Expand Down

0 comments on commit 64a91c5

Please sign in to comment.