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(input): clearable bug while use chinese input #979

Closed
wants to merge 3 commits into from

Conversation

Volankey
Copy link
Collaborator

@Volankey Volankey commented Aug 26, 2021

Fix #905
我也不知道为啥在 clearable 情况下,mouseleave事件会触发compositionEnd,只知道是这个问题

@vercel
Copy link

vercel bot commented Aug 26, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tusimple/naive-ui/CBNP5JqFnR8vepitdcmystevyDTN
✅ Preview: https://naive-ui-git-fork-volankey-input-bug-tusimple.vercel.app

@codecov
Copy link

codecov bot commented Aug 26, 2021

Codecov Report

Merging #979 (685a1e7) into main (25d4a74) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #979      +/-   ##
==========================================
- Coverage   47.12%   47.11%   -0.01%     
==========================================
  Files         511      511              
  Lines       12593    12594       +1     
  Branches     3548     3549       +1     
==========================================
  Hits         5934     5934              
- Misses       5632     5633       +1     
  Partials     1027     1027              
Impacted Files Coverage Δ
src/input/src/Input.tsx 46.40% <0.00%> (-0.16%) ⬇️

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 25d4a74...685a1e7. Read the comment docs.

@XieZongChen
Copy link
Collaborator

从问题解决的办法来看,貌似输入法的聚焦和组件的聚焦有关,而 mouseleave 之前直接一刀切的将 hover 事件移除,所以影响到输入法的聚焦了,从而导致这个问题。这样理解是否正确? @Volankey @07akioni

@07akioni
Copy link
Collaborator

@Volankey 这和之前的 form item 的一个 bug 有关,关联一下看看对不对

@Volankey
Copy link
Collaborator Author

从问题解决的办法来看,貌似输入法的聚焦和组件的聚焦有关,而 mouseleave 之前直接一刀切的将 hover 事件移除,所以影响到输入法的聚焦了,从而导致这个问题。这样理解是否正确? @Volankey @07akioni

可以这么理解,但是并不在的为啥 mouseleave 会触发 compositionEnd`

@Volankey
Copy link
Collaborator Author

@Volankey 这和之前的 form item 的一个 bug 有关,关联一下看看对不对

对,就是找的 #905 的问题,发现最终是 clearableinput 组件都有这个问题

@Volankey
Copy link
Collaborator Author

Volankey commented Sep 1, 2021

合一下pr @07akioni

hoverRef.value = false
// FIX: https://github.com/TuSimple/naive-ui/issues/905
if (!isComposingRef.value) {
hoverRef.value = false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我发现这个 hoverRef.value 会影响 showClearButton,这不是正确的改法,想要避免 rerender 需要 useMemo

@07akioni 07akioni closed this in 3db73a5 Sep 1, 2021
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.

表单的输入框在开启自定义验证后存在中文输入问题
4 participants