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(popover): select in popover close bug #818 #822

Merged
merged 1 commit into from
May 9, 2022
Merged

fix(popover): select in popover close bug #818 #822

merged 1 commit into from
May 9, 2022

Conversation

shijiatongxue
Copy link
Collaborator

@shijiatongxue shijiatongxue commented May 7, 2022

中文模板 / Chinese Template

What kind of change does this PR introduce? (check at least one)

  • Bugfix

PR description

Fixes #818

问题:

image

代码实现上我们想在弹出层的 react 处理函数中取消冒泡以不触发外层 document 上的处理函数。但是这依赖于 document 上监听事件的时机晚于 react 绑定事件的时机。

  • react17 以后,react 事件委托在 root 节点,其实不会有这个问题~

更新:

  • 这里我们为了兼容 16 将 document 监听 clickoutside 修改为 window 监听。
  • 同时取消了在 capture 阶段监听。capture 阶段监听无法处理嵌套场景。

处理办法参考 react issue : facebook/react#4335 (comment)

Changelog

🇨🇳 Chinese


🇺🇸 English

Checklist

  • Test or no need
  • Document or no need
  • Changelog or no need

Other

  • Skip Changelog

Additional information

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 7, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 938c7ad:

Sandbox Source
pr-story Configuration
Semi Design: Simple Story Configuration

@codecov-commenter
Copy link

Codecov Report

Merging #822 (938c7ad) into main (b9890dd) will decrease coverage by 0.00%.
The diff coverage is 60.00%.

@@            Coverage Diff             @@
##             main     #822      +/-   ##
==========================================
- Coverage   80.29%   80.28%   -0.01%     
==========================================
  Files         438      438              
  Lines       22363    22366       +3     
  Branches     5405     5406       +1     
==========================================
+ Hits        17956    17957       +1     
- Misses       4386     4388       +2     
  Partials       21       21              
Impacted Files Coverage Δ
packages/semi-ui/tooltip/index.tsx 87.98% <60.00%> (-0.59%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b9890dd...938c7ad. Read the comment docs.

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.

Select inside Popover, clicking the option to select it will cause the Popover hide
3 participants