Repository navigation
fix(Button): prevent navigation while disabled or loading - #4495
Closed
jadelike-wine wants to merge 1 commit into
Closed
jadelike-wine wants to merge 1 commit into
jadelike-wine wants to merge 1 commit into
Conversation
Collaborator
TDesign Component Site Preview Open
|
commit: |
jadelike-wine
marked this pull request as ready for review
November 19, 2026 02:24
jadelike-wine
requested review from
HaixingOoO,
NWYLZW,
RylanBot,
ZWkang,
carolin913,
honkinglin and
uyarn
as code owners
November 19, 2026 02:24
Collaborator
|
fixed in #4493 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🤔 这个 PR 的性质是?
🔗 相关 Issue
Fixes #4490
💡 需求背景和解决方案
href配合loading,或显式tag="a"配合disabled/loading时,Button 仍会渲染带 href 的锚点。<a>不识别 disabled 属性,移除 onClick 也不会取消链接的默认导航。先根据 tag/href 解析有效标签,再将不可交互的锚点回退为 div;保留既有的隐式 disabled → div 行为、显式 button/div 标签和无 href loading 按钮的原生 disabled/submit 语义。useMemo 依赖直接包含 loading。
新增 11 个回归用例,按仓库规范放入 props/scenarios:
基线
933ee59f上原有 31 个 Button 测试通过,新增测试中 8 个按预期因锚点未回退失败;修复后 42/42 通过。既有快照未修改。📝 更新日志
tdesign-react
@tdesign-react/chat
N/A
☑️ 请求合并前的自查清单
验证与局限
环境:macOS,Node.js 22.23.5,pnpm 10.33.0。
pnpm exec vitest run packages/components/button/__tests__/button.test.tsx:42/42 通过。pnpm lint(包括lint:tsc):通过。pnpm exec vitest run --maxWorkers=2 --minWorkers=2:88 个文件通过,1442 个测试通过、1 个跳过。pnpm exec cross-env NODE_ENV=test-snap vitest run --maxWorkers=2 --minWorkers=2:2 个文件通过,1920 个测试通过。首次默认并发运行 pnpm test 时,Guide 动画阶段快照和 Dropdown 等待菜单消失的定时断言失败;两文件未改动重跑后 38/38 通过,随后以两个 worker 重跑完整套件。测试验证 DOM 链接语义和事件行为,jsdom 不执行真实浏览器页面导航;本次未运行浏览器端到端导航测试。
AI-assisted contribution.