Skip to content

fix(Mask): clip click blockers at viewport edges - #109

Open
nrps9909 wants to merge 1 commit into
react-component:masterfrom
nrps9909:codex/tour-mask-overflow-73
Open

fix(Mask): clip click blockers at viewport edges#109
nrps9909 wants to merge 1 commit into
react-component:masterfrom
nrps9909:codex/tour-mask-overflow-73

Conversation

@nrps9909

@nrps9909 nrps9909 commented Aug 18, 2026

Copy link
Copy Markdown

Summary

  • keep SVG click-blocker dimensions non-negative when the Tour gap extends outside the mask viewport
  • clip viewport-sized bottom and right blockers with explicit hidden overflow instead of generating negative calc() dimensions
  • add regression coverage for normal geometry and right/bottom and left/top overflow boundaries

Fixes #73

Validation

  • exact base with the new regression: 3/3 tests failed on missing clipping, negative calc() sizing, and negative blocker origins
  • patched full suite: 3 suites, 37 tests, and 16 snapshots passed
  • npm run tsc
  • npm run compile
  • npx eslint src/Mask.tsx tests/Mask.test.tsx
  • npx prettier --check src/Mask.tsx tests/Mask.test.tsx
  • git diff --check
  • headless Chrome hit-test: all four blockers intercept outside clicks, the visible gap remains click-through, and points outside the SVG are unaffected

This does not change the public API.

AI assistance disclosure: Codex was used to trace the SVG geometry, audit current issues and pull requests for duplicate work, construct and run the red/green regression, validate browser hit-testing, and prepare this pull request. The source diff, snapshots, and validation results were checked against the exact current base.

Summary by CodeRabbit

  • Bug Fixes
    • 修复遮罩区域底部和右侧的点击阻断范围计算问题。
    • 改善目标区域接近或超出视口边界时的表现,避免出现异常尺寸。
    • 当目标位于遮罩上方或左侧时,正确限制无效阻断区域,提升点击交互的准确性。
  • Tests
    • 增加多种遮罩边界和点击阻断场景的测试覆盖。

@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

@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.

@nrps9909 nrps9909 changed the title "'fix(Mask): clip click blockers at viewport edges'" fix(Mask): clip click blockers at viewport edges Aug 18, 2026
@coderabbitai

coderabbitai Bot commented Aug 18, 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: 9b9f2bb5-d6bb-4060-9cb6-d39454ece251

📥 Commits

Reviewing files that changed from the base of the PR and between 1cd4d96 and d2af82f.

⛔ Files ignored due to path filters (1)
  • tests/__snapshots__/index.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (2)
  • src/Mask.tsx
  • tests/Mask.test.tsx

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


Walkthrough

Mask 为 SVG 增加 overflow: hidden,并调整底部、右侧阻挡矩形的定位和尺寸计算。新增测试覆盖正常位置、视口边界及目标区域超出遮罩范围的情况。

Changes

Mask 遮罩几何

Layer / File(s) Summary
阻挡区域计算
src/Mask.tsx
SVG 隐藏溢出内容。底部和右侧阻挡矩形从目标区域边界开始,并使用 100% 尺寸。
边界几何验证
tests/Mask.test.tsx
新增测试辅助函数和几何测试,覆盖正常位置、右下边界溢出,以及目标位于上方或左侧的情况。

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to d2af8

The change localizes click blockers within the mask viewport without changing the public API, with regression coverage and validation for normal and overflow geometry. No actionable merge-blocking risk remains beyond normal checks and review.

Poem

小兔挥爪画遮罩,
边界之外不乱跑。
负尺寸被轻轻挡,
点击区域排得好。
测试蹦跳来验收。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed 代码通过非负阻挡区域尺寸和 SVG 隐藏溢出处理了 Issue #73 的负尺寸错误,并新增了相关回归测试。
Out of Scope Changes check ✅ Passed 所有变更均围绕 Mask 点击阻挡区域的视口边界处理和回归测试,没有发现无关改动。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了 Mask 点击阻挡区域在视口边缘裁剪的主要变更。
✨ 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Errors messages in the console

1 participant