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

feat: add keepAlign props #227

Closed
wants to merge 1 commit into from
Closed

feat: add keepAlign props #227

wants to merge 1 commit into from

Conversation

kerm1it
Copy link
Member

@kerm1it kerm1it commented Oct 13, 2020

改动点

添加 keepAlign 属性,当子元素移动时,是否始终保持与子元素对齐,默认为 false

解决的问题

发现在 在 rc-tooltip@3.7.3 版本及其之前版本是有这个特性的,之后版本就没有了,应该是 rc-trigger 升级导致。这样以来,rc-slider 拖拽时,tooltip 就不会随着 handle 位置改变而改变(https://github.com/react-component/slider/issues/693)。

antd 中也为 Slider 开发了这个功能,因此这次把这个功能移植到 rc-tooltip 中来,顺便解决 rc-slider 的问题。

@afc163 @zombieJ 觉得没问题的话,我再加上测试用例。

@codecov
Copy link

codecov bot commented Oct 13, 2020

Codecov Report

Merging #227 into master will decrease coverage by 9.65%.
The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #227      +/-   ##
==========================================
- Coverage   90.90%   81.25%   -9.66%     
==========================================
  Files           3        3              
  Lines          33       48      +15     
  Branches       12       14       +2     
==========================================
+ Hits           30       39       +9     
- Misses          3        9       +6     
Impacted Files Coverage Δ
src/Tooltip.tsx 78.04% <60.00%> (-10.42%) ⬇️

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 c1d6243...e4ae8e5. Read the comment docs.

@zombieJ
Copy link
Member

zombieJ commented Oct 14, 2020

rc-slider 那个是 workaround,看看是不是可以这次直接用根本上解决对齐问题(比如 getPopupContainer?)?

@kerm1it
Copy link
Member Author

kerm1it commented Oct 14, 2020

我之前试过把 getPopupContainer 设置为当前元素,这样会一直跟着移动。

但是会有样式问题,因为 handle 的宽度非常小,里面的 tooltip 内容如果多一点,就会换行。

@kerm1it
Copy link
Member Author

kerm1it commented Oct 14, 2020

ping @zombieJ @afc163 ~

@zombieJ
Copy link
Member

zombieJ commented Oct 15, 2020

能搞个 branch 我看看不?

@kerm1it
Copy link
Member Author

kerm1it commented Oct 15, 2020

react-component/slider#696 看这个 PR 的预览链接。

@kerm1it kerm1it closed this Oct 19, 2020
shc023 pushed a commit to shc023/tooltip that referenced this pull request Jul 31, 2021
…nt#227)

* show popup at the same document as the trigger element

* use current document in all use cases
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.

None yet

2 participants