fix: preserve child aria-describedby - #542
Conversation
|
@nrps9909 is attempting to deploy a commit to the afc163's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. WalkthroughTooltip 现在保留子元素已有的 ChangesTooltip 描述属性
Estimated code review effort: 2 (简单) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change preserves existing child descriptions while composing them with the tooltip description when visible; no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files. ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #542 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 36 38 +2
Branches 14 15 +1
=========================================
+ Hits 36 38 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Preserve an existing child
aria-describedbywhen the tooltip is hidden, and compose it with the generated tooltip id while the tooltip is open.Problem
The current child clone always supplies
aria-describedby. When the tooltip is closed it suppliesundefined, which removes a description already owned by the child. When the tooltip opens, the generated tooltip id replaces that existing description instead of joining the ARIA ID-reference list.I found this while validating ant-design/ant-design#59110: a Slider handle passed
ariaDescribedByForHandlereceives the attribute from rc-slider, but the default Ant Design SliderTooltip wrapper removes it.Validation
The regression covers the full controlled visibility cycle:
Exact-base behavior fails the first assertion. On this head:
npm test -- --runInBand tests/index.test.tsx: 30 tests passednpm run coverage -- --runInBand: 100% statements, branches, functions, and linesnpm run tscnpm run lintnpx prettier --check src/Tooltip.tsx tests/index.test.tsxnpm run compile(ESM, CJS, declarations, and Less assets)git diff --checkAI assistance disclosure: Codex was used to trace the Ant Design integration failure, construct the exact-base regression, and run the validation matrix. The behavior and results above were verified locally.
Summary by CodeRabbit