Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dynamic-tags): fix abnormal behavior when using keyboard to trigger add button #5080

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading