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

Mention 组件点击 focus 定位问题 #3801

Closed
afc163 opened this issue Nov 11, 2016 · 9 comments
Closed

Mention 组件点击 focus 定位问题 #3801

afc163 opened this issue Nov 11, 2016 · 9 comments
Labels

Comments

@afc163
Copy link
Member

afc163 commented Nov 11, 2016

在线演示:https://ant.design/components/mention/

Chrome 问题及重现步骤

  1. 点击空白处。示意图
  2. focus 到了文字开头。(非预期行为
  3. 点击外部 blur。
  4. 再次点击空白处。示意图
  5. focus 到文字尾部。(预期行为)

Firefox 问题及重现步骤

  1. 点击空白处。示意图
  2. focus 到了文字尾部。(预期行为)
  3. 点击外部 blur。
  4. 再次点击空白处。示意图
  5. focus 到文字开头。(非预期行为
RaoHai added a commit to react-component/editor-core that referenced this issue Nov 11, 2016
@RaoHai
Copy link
Contributor

RaoHai commented Nov 11, 2016

tnpm -i

@RaoHai RaoHai closed this as completed Nov 11, 2016
@zheeeng
Copy link
Contributor

zheeeng commented Apr 10, 2018

@afc163 It still happens to me (antd: 3.4, chrome: 65). The Mention is controlled and with multiLines.
There is a reproduction: https://codepen.io/zheeeng/pen/qogqWr. (don't focus on why separating editorState from value, actually, I use Mobx, editorState can't be converted to Observable)

@afc163 afc163 reopened this Apr 10, 2018
@afc163
Copy link
Member Author

afc163 commented Apr 10, 2018

@RaoHai

@RaoHai
Copy link
Contributor

RaoHai commented Apr 10, 2018

在看了

@zheeeng
Copy link
Contributor

zheeeng commented Apr 10, 2018

Hi, @RaoHai There is another issue on Mention Component.

Focus/blur on Mention will trigger onChange event. and if the Mention is multi-lines, click beside the first line, the onChange event will be fired twice, it seems unexpected.

e.g. Manually set value of mention, focus event fired, and the cursor is positioned at the start of the text.

@afc163
Copy link
Member Author

afc163 commented May 11, 2018

@RaoHai

@afc163
Copy link
Member Author

afc163 commented Jun 30, 2018

@RaoHai 有进展不

@zheeeng
Copy link
Contributor

zheeeng commented Jul 4, 2018

Didn't dig into this draft.js, I have an assumption that Selection API may benefit this problem. Maybe we could try to save and restore the position of the selection cursor in handling change/input event.

@afc163
Copy link
Member Author

afc163 commented Nov 4, 2018

Duplicate of #12931

@afc163 afc163 marked this as a duplicate of #12931 Nov 4, 2018
@afc163 afc163 closed this as completed Nov 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants