Skip to content

fix: render numeric zero dialog chrome - #586

Open
nrps9909 wants to merge 1 commit into
react-component:masterfrom
nrps9909:codex/render-zero-header-footer
Open

fix: render numeric zero dialog chrome#586
nrps9909 wants to merge 1 commit into
react-component:masterfrom
nrps9909:codex/render-zero-header-footer

Conversation

@nrps9909

@nrps9909 nrps9909 commented Aug 27, 2026

Copy link
Copy Markdown

Summary

  • render numeric 0 passed through the public ReactNode title and footer props
  • keep the dialog's aria-labelledby relationship when the title is zero
  • cover the header, footer, and accessible-name wiring with a regression test

Problem

title and footer accept ReactNode, but Panel used truthiness checks to decide whether to render them. As a result, a valid numeric zero was silently dropped. For title={0}, the title element was also omitted and the dialog lost its aria-labelledby reference.

The fix distinguishes numeric zero from other falsy React values while preserving the existing behavior for empty strings, false, null, and undefined.

Validation

  • exact-base regression test failed before the implementation and passes afterward
  • full Jest suite: 6 suites passed, 61 tests passed, 1 existing skipped, 4 snapshots passed
  • TypeScript (tsc --noEmit)
  • ESLint (0 errors; one existing file-level unused-disable warning when linting the test directly)
  • Prettier check
  • git diff --check

I checked current open issues and pull requests. I found no report or PR for numeric-zero title/footer rendering. There are older unrelated PRs that also touch Panel.tsx, but none changes these render conditions.

AI assistance disclosure: Codex was used to trace the render conditions, audit open issues/PR files, run the exact-base regression, and draft this report. The implementation and test are directly reproducible from this branch.

Summary by CodeRabbit

  • Bug 修复

    • 修复对话框标题或页脚为数值 0 时无法正常显示的问题。
    • 确保标题为 0 时,辅助技术关联属性仍能正确指向标题元素。
  • 测试

    • 增加对标题和页脚显示 0,以及无障碍关联属性正确性的验证。
@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

@nrps9909 is attempting to deploy a commit to the React Component Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 804f2bac-7767-430b-9291-d99b1f43e943

📥 Commits

Reviewing files that changed from the base of the PR and between a2efbc4 and eab2153.

📒 Files selected for processing (2)
  • src/Dialog/Content/Panel.tsx
  • tests/index.spec.tsx

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

Changes

Dialog 0 值内容支持

Layer / File(s) Summary
Panel 内容渲染与可访问性
src/Dialog/Content/Panel.tsx, tests/index.spec.tsx
Panel 将数值 0 视为有效的 titlefooter 内容。标题为 0 时,aria-labelledby 继续指向标题元素。测试覆盖标题、页脚及可访问性关联。

Estimated code review effort: 1 (简单) | ~5 分钟

Merge Risk: ⚪ Minimal · up to eab21

Numeric zero now renders correctly in dialog titles and footers while preserving accessibility wiring, with no actionable merge-blocking risk remaining after normal checks and review.

Suggested reviewers: afc163, emilyyyliu

Poem

小兔看见标题零,
页脚也把零写清。
Panel 不再漏数字,
ARIA 牵好标题铃,
测试点头跳两蹦。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了主要变更:修复 Dialog 中数值 0 的 title 和 footer 渲染问题。标题简洁且与变更内容直接相关。
Docstring Coverage ✅ Passed 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…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

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 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

1 participant