Skip to content

fix(Select): Even if set disabled options Tag still can be deleted #5488

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

Merged
merged 9 commits into from
May 29, 2025

Conversation

Wesley-0808
Copy link
Collaborator

@Wesley-0808 Wesley-0808 commented May 22, 2025

🤔 这个 PR 的性质是?

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

🔗 相关 Issue

💡 需求背景和解决方案

📝 更新日志

  • 本条 PR 不需要纳入 Changelog

tdesign-vue-next

  • fix(Select): 修复多选模式下,存在不可选的选项已在选中项中时,仍可通过标签按钮和键盘删除的缺陷

@tdesign-vue-next/chat

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

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

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

@tdesign-bot
Copy link
Collaborator

tdesign-bot commented May 22, 2025

TDesign Component Site Preview Open

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

Copy link

pkg-pr-new bot commented May 22, 2025

tdesign-vue-next-demo

npm i https://pkg.pr.new/tdesign-vue-next@5488

commit: bf4b628

@Wesley-0808
Copy link
Collaborator Author

/update-snapshot

Copy link
Contributor

⏳ 正在运行快照更新。。。 CI: Open

@uyarn uyarn requested a review from Copilot May 29, 2025 10:34
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where in multiple mode a disabled option's tag could still be removed via the backspace key or tag deletion.

  • Introduces a new logic branch to skip disabled options when removing by backspace.
  • Refactors the value display rendering in multiple selection mode using a new renderValueDisplay function.
  • Updates example and snapshot files for consistency.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/components/select/select.tsx Adds backspace handling for disabled options and refactors valueDisplay logic.
packages/components/select/_example/multiple.vue Updates default selected values for the multiple selection demo.
packages/components/select/tests/snapshots/index.test.jsx.snap Minor snapshot formatting adjustments.
Comments suppressed due to low confidence (1)

packages/components/select/select.tsx:205

  • [nitpick] The variable name 'values' is used to represent a single option. Consider renaming it to 'targetOption' or 'removedOption' for clarity.
const values = currentSelected[closest];

@uyarn uyarn merged commit dfa8fa4 into develop May 29, 2025
1 check passed
@uyarn uyarn deleted the wesley/fix/select branch May 29, 2025 10:41
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.

3 participants