Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 29, 2025

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

#5175

💡 需求背景和解决方案

多选下拉框在 filterable 模式下,使用键盘上下键导航后按回车,无法选中高亮的选项。

根因: useKeyboardControl.ts 中 Enter 处理逻辑存在以下问题:

  • 访问 finalOptions[hoverIndex.value] 时缺少空值检查
  • !optionValue 判断会拦截 0''false 等有效 falsy 值
  • selectPanelRef.valuepopupContentRef.value 缺少可选链

修复:

  • 添加 currentOption 安全检查,防止访问 undefined
  • !optionValue 改为 optionValue === undefined
  • 添加可选链 selectPanelRef.value?.isVirtualpopupContentRef.value?.scrollTo?.()

📝 更新日志

  • 本条 PR 不需要纳入 Changelog

tdesign-vue-next

  • fix(select): 修复多选可搜索下拉框键盘回车无法选中选项的问题 #5175

@tdesign-vue-next/chat

@tdesign-vue-next/auto-import-resolver

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供
Original prompt

This section details on the original issue you should resolve

<issue_title>[Select]多选下拉框,filterable情况下键盘上下移动后回车选项没有被选中</issue_title>
<issue_description><t-select
v-model="value1"
:options="options1"
placeholder="请选择云解决方案"
multiple
filterable
@Focus="onFocus"
@blur="onBlur"
/></issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix multi-select dropdown selection issue with keyboard navigation fix(select): fix keyboard Enter key selection in multi-select filterable dropdown Nov 29, 2025
Copilot AI requested a review from liweijie0812 November 29, 2025 15:08
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 29, 2025

  • tdesign-vue-next-demo

    npm i https://pkg.pr.new/Tencent/tdesign-vue-next/@tdesign-vue-next/auto-import-resolver@6217
    
    npm i https://pkg.pr.new/Tencent/tdesign-vue-next@6217
    
    npm i https://pkg.pr.new/Tencent/tdesign-vue-next/@tdesign-vue-next/chat@6217
    

commit: 9600446

@tdesign-bot
Copy link
Collaborator

tdesign-bot commented Nov 30, 2025

TDesign Component Site Preview Open

Component Preview
tdesign-vue-next 完成
@tdesign-vue-next/chat 完成

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Select]多选下拉框,filterable情况下键盘上下移动后回车选项没有被选中

3 participants