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

SeachBar 口碑掌柜onClear时需要支持focus #1721

Closed
pingan1927 opened this issue Aug 22, 2017 · 17 comments
Closed

SeachBar 口碑掌柜onClear时需要支持focus #1721

pingan1927 opened this issue Aug 22, 2017 · 17 comments
Assignees
Labels

Comments

@pingan1927
Copy link
Contributor

Version

1.6.3

Environment

web

FT

@ant-design-bot
Copy link

It will be better to write your issue/comment in English, so more people can understand you.
And this means that more people can help you or benefit from your issue/comment.
See: ant-design/ant-design#4897

@pingan1927 pingan1927 self-assigned this Aug 22, 2017
@paranoidjk
Copy link
Contributor

基于这个 #1243

在 onClear 的时候手动调用 focus 就好了

没必要把这些代码逻辑都集成到组件内部。

@pingan1927
Copy link
Contributor Author

问题在于onClear的时候点击了非input区域,input失去了光标,按照交互要求,清楚内容时键盘不应该收起。需要快速再通过脚本获取光标。 #1243 的问题我具体看看 这周会再改一次searchbar

@silentcloud
Copy link
Contributor

iOS 原生 searchBar 也是这么个交互,clear 的时候还是 focus 的

@paranoidjk
Copy link
Contributor

那就按原生交互来,clear 的时候保证 Input 不要 blur。

@pingan1927
Copy link
Contributor Author

0.9.x 还是好的 1.6.x 因为兼容性去掉了部分客户端的onClear后的focus 被怼的无话可说

pingan1927 added a commit that referenced this issue Aug 23, 2017
pingan1927 added a commit that referenced this issue Aug 23, 2017
pingan1927 added a commit that referenced this issue Aug 28, 2017
* fix searchBar onClear #1721

* optimize code

* remove unused comment

* modify changelog
@GuokrSun
Copy link

GuokrSun commented Aug 29, 2017

Version 1.6.4
现在onCancel 不好使了,点了跟 点clear 图标一个效果,不能恢复未点击的那个状态了
环境 魅族pro5 (Android7)、网页(chrome60)

@paranoidjk
Copy link
Contributor

@GuokrSun 什么机型?能否提供可复现的 demo?

@pingan1927
Copy link
Contributor Author

onCancel的默认行为就是onClear

@GuokrSun
Copy link

它不应该回复到 未点击的状态吗

@paranoidjk
Copy link
Contributor

@pingan1927 不是的,跟以前行为不一致了,以前点取消是收起 cancel。http://beta.mobile.ant.design/components/search-bar-cn

@GuokrSun
Copy link

通过『取消按钮』退出激活状态
就是现在不收取 取消 是对的是吗? 按理应该退出激活状态啊

@pingan1927
Copy link
Contributor Author

@GuokrSun

  onCancel = () => {
    if (this.props.onCancel) {
      this.props.onCancel(this.state.value);
    } else {
      this.onClear();
    }
  }

@GuokrSun
Copy link

就是现在改成 得自己手动加代码了 是吗

@pingan1927
Copy link
Contributor Author

@GuokrSun 你说的我明白,取消按钮的行为自行传入回调,试试看,onClear的代码必须优化。回头我会把onCancel的默认行为去掉。

@GuokrSun
Copy link

好的 谢谢各位大大

@paranoidjk
Copy link
Contributor

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

5 participants