Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use pointerDown to check if click with portal #493

Merged
merged 2 commits into from
Nov 8, 2024
Merged

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented Nov 8, 2024

ref #434

Summary by CodeRabbit

  • 新功能

    • 更新了弹出窗口组件的事件处理,改用 onPointerDownCapture,提高了用户交互体验。
    • 增强了对指针事件的处理,防止弹出窗口在点击时意外关闭。
  • 测试

    • 更新了测试用例,改用 fireEvent.pointerDownfireEvent.mouseDown,提高事件模拟的准确性。
    • 扩展了对多个触发器的上下文菜单操作的测试,确保弹出窗口的可见性正确管理。

Copy link

coderabbitai bot commented Nov 8, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

此次更改涉及多个文件,主要修改了与指针事件相关的功能。PopupProps接口中的事件处理器从onMouseDownCapture更改为onPointerDownCapture,以支持更好的指针事件捕获。useWinClick钩子引入了新的逻辑,以防止在弹出窗口内的点击事件意外触发关闭。TriggerProps接口和generateTrigger函数也进行了更新,以改善弹出窗口的可见性管理和响应性。最后,测试用例进行了调整,以更准确地模拟事件并验证组件行为。

Changes

文件路径 更改摘要
src/Popup/index.tsx PopupProps接口中的onMouseDownCapture更改为onPointerDownCapture
src/hooks/useWinClick.ts 添加popupPointerDownRef以跟踪指针事件,更新onTriggerClose函数以防止意外关闭弹出窗口。
src/index.tsx 移除TriggerProps接口中的getDocument属性,更新generateTrigger函数以改善弹出窗口的事件处理和可见性管理。
tests/basic.test.jsx fireEvent.click替换为fireEvent.pointerDownfireEvent.mouseDown,增强事件模拟的准确性。

Possibly related PRs

Poem

在草地上跳跃的小兔,
指针事件来临,真是好事!
弹出窗口不再轻易关,
点击间欢笑声连连。
让我们一起庆祝这变化,
兔子们的乐园更加美妙! 🐰✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.75%. Comparing base (d8bfea2) to head (1019cc9).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #493      +/-   ##
==========================================
+ Coverage   97.73%   97.75%   +0.01%     
==========================================
  Files          13       13              
  Lines         794      800       +6     
  Branches      239      239              
==========================================
+ Hits          776      782       +6     
  Misses         18       18              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zombieJ zombieJ merged commit a412327 into master Nov 8, 2024
9 of 10 checks passed
@zombieJ zombieJ deleted the fix-with-pointer branch November 8, 2024 08:57
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