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(popup): 嵌套浮层内触发 mouseDown、click 时不应该关闭上一级的浮层 #594

Merged
merged 1 commit into from
Apr 14, 2022

Conversation

nia3y
Copy link
Contributor

@nia3y nia3y commented Apr 9, 2022

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

当点击嵌套浮层的浮层时,会导致第一个浮层关闭
https://codesandbox.io/s/tdesign-react-demo-forked-tsjvyj?file=/src/demo.jsx

💡 需求背景和解决方案

通过浮层中监听 onMouseDown 来阻止 clickOutSide 事件触发

📝 更新日志

  • fix(popup): 嵌套浮层内触发 mouseDown、click 时不应该关闭上一级的浮层

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (develop@e173ee6). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             develop     #594   +/-   ##
==========================================
  Coverage           ?   64.91%           
==========================================
  Files              ?      723           
  Lines              ?    12477           
  Branches           ?     2994           
==========================================
  Hits               ?     8099           
  Misses             ?     4378           
  Partials           ?        0           

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 e173ee6...f40c1f8. Read the comment docs.

@github-actions
Copy link
Contributor

完成

@honkinglin
Copy link
Collaborator

这里popup的逻辑确实没考虑到嵌套的场景,目前我是给 portal 的attch函数支持传入 triggerNode 方便渲染在第一个popup 节点内处理的,我看看你这个方式是不是更好一点
#616

@honkinglin
Copy link
Collaborator

本地测了下没问题,如果要支持移动端体验也正常的话还得再加个 touchStart 事件
然后发现 onKeydown 事件逻辑也有点问题哈哈,只能关闭最后一个,不过这个功能用的比较少还好
如果有空的话老哥可以再提个pr一起完善下~

@honkinglin honkinglin merged commit c475255 into Tencent:develop Apr 14, 2022
@nia3y
Copy link
Contributor Author

nia3y commented Apr 14, 2022

好的

uyarn pushed a commit that referenced this pull request Apr 18, 2022
fix(popup):  嵌套浮层内触发 mouseDown、click 时不应该关闭上一级的浮层
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.

3 participants