diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index e8791b70943..62eb23873b1 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -7,6 +7,7 @@ - Fix `n-timeline-item`'s `title`'s `margin-bottom` can't be set by theme variable, closes [#3722](https://github.com/tusen-ai/naive-ui/issues/3722). - Fix `n-timeline-item`'s `meta` part's `margin-bottom` is overrided when nested in horizontal and vertical mode. - Fix `n-tree-select` would remove selected first option if it's clicked when placed in `label` tag, closes [#3715](https://github.com/tusen-ai/naive-ui/issues/3715). +- Fix `n-select`'s overflow popover won't hide after removing all options in it when `maxTagCount="responsive"`, closes [#3801](https://github.com/tusen-ai/naive-ui/issues/3801). ### Feats diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 0f07ef28503..1009b95566d 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -7,6 +7,7 @@ - 修复 `n-timeline-item` 的 `title` 的 `margin-bottom` 无法通过主题变量设置,关闭 [#3722](https://github.com/tusen-ai/naive-ui/issues/3722) - 修复 `n-timeline-item` 的 `meta` 在水平垂直嵌套时 `margin-bottom` 被覆盖 - 修复 `n-tree-select` 在放置于 `label` 标签内时点击会删除掉第一个选中的选项,关闭 [#3715](https://github.com/tusen-ai/naive-ui/issues/3715) +- 修复 `n-select` 在 `maxTagCount="responsive"` 的情况下,在弹层删除掉所有已选中项后,弹层不会消失,关闭 [#3801](https://github.com/tusen-ai/naive-ui/issues/3801) ### Feats diff --git a/src/_internal/selection/src/Selection.tsx b/src/_internal/selection/src/Selection.tsx index 6be5439d78b..fc059415cda 100644 --- a/src/_internal/selection/src/Selection.tsx +++ b/src/_internal/selection/src/Selection.tsx @@ -346,7 +346,9 @@ export default defineComponent({ if (props.disabled || props.active) return clearEnterTimer() enterTimerId = window.setTimeout(() => { - showTagsPopoverRef.value = true + if (selectedRef.value) { + showTagsPopoverRef.value = true + } }, 100) } function handleMouseLeaveCounter (): void { @@ -358,6 +360,11 @@ export default defineComponent({ showTagsPopoverRef.value = false } } + watch(selectedRef, (value) => { + if (!value) { + showTagsPopoverRef.value = false + } + }) onMounted(() => { watchEffect(() => { const patternInputWrapperEl = patternInputWrapperRef.value