Skip to content

fix(align): restore overflowX and overflowY after force align#615

Open
ffgenius wants to merge 1 commit intoreact-component:masterfrom
ffgenius:overflow
Open

fix(align): restore overflowX and overflowY after force align#615
ffgenius wants to merge 1 commit intoreact-component:masterfrom
ffgenius:overflow

Conversation

@ffgenius
Copy link
Copy Markdown

@ffgenius ffgenius commented Apr 12, 2026

solve ant-design/ant-design#57665

Summary by CodeRabbit

发布说明

  • Bug 修复

    • 改进弹出窗口对齐过程,确保正确保持和恢复溢出样式设置
  • 测试

    • 添加测试用例,验证对齐过程中溢出样式的保持一致性

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 24fc0314-361c-4de3-8f1e-4edf8064647b

📥 Commits

Reviewing files that changed from the base of the PR and between 59b659d and e22c60b.

📒 Files selected for processing (2)
  • src/hooks/useAlign.ts
  • tests/align.test.tsx

Walkthrough

useAlign 钩子现在会在临时隐藏弹出元素进行对齐计算时,捕获并恢复其 overflowXoverflowY 样式属性,确保对齐完成后这些样式值被正确还原。新增测试用例验证此行为。

Changes

Cohort / File(s) Summary
Hook 改动
src/hooks/useAlign.ts
在对齐计算前读取 overflowXoverflowY 样式值,计算完成后恢复这些值以保持原始溢出样式配置。
测试验证
tests/align.test.tsx
新增测试用例验证弹出元素在重新对齐后,overflowXoverflowY 样式值能够被正确保留。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • afc163
  • zombieJ

Poem

🐰 一只兔子的颂歌

样式之流,我来守护,
溢出的秘密已收妥善,
对齐重来,衣裳依旧,
测试见证,变化无悔。
小修小补,大爱无声 ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确地总结了主要变更,清晰地反映了修复的核心内容。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 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 and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the useAlign hook to capture and restore overflowX and overflowY styles, preventing them from being lost during alignment. It also includes a test case to confirm the fix. A review comment suggests removing an unnecessary empty line to maintain consistent code formatting.

const originOverflow = popupElement.style.overflow;
const originOverflowX = popupElement.style.overflowX;
const originOverflowY = popupElement.style.overflowY;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This extra empty line is redundant and deviates from the existing code style in this file. It's recommended to remove it to keep the code clean and maintain consistent spacing.

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.

1 participant