ElemeFE / element

A Vue.js 2.0 UI Toolkit for Web
https://element.eleme.io/
MIT License
54.11k stars 14.64k forks source link

[Bug Report] input autofocus can only be focused once in dialog. #12576

Closed zlab closed 6 years ago

zlab commented 6 years ago

Element UI version

2.4.6

OS/Browsers version

chrome68

Vue version

2.5.17

Reproduction Link

https://jsfiddle.net/zhanqi/u9aw31jf/

Steps to reproduce

  1. 点击【测试】按钮
  2. 第一个输入框获得了焦点 3.点击关闭,dialog已销毁 4.点击【测试】按钮 5.无法获得焦点

What is Expected?

每次打开都能获得焦点

What is actually happening?

只有第一次可以获得焦点

element-bot commented 6 years ago

Translation of this issue:

Element UI version 2.4.6

OS/Browsers version Chrome68

Vue version 2.5.17

Reproduction Link https://jsfiddle.net/zhanqi/u9aw31jf/

Steps to reproduce

  1. click the test button.

  2. the first input box got the focus.

  3. click close, dialog has been destroyed.

  4. click the test button.

  5. unable to get focus.

What is Expected? Every time you open it, you get the focus.

What is actually happening? Only for the first time can we get the focus.

zlab commented 6 years ago

mac safari 没有问题,mac chrome68可以重现

ziyoung commented 6 years ago

应该是 autofocus 属性的兼容性问题,可以试着监听 visible 的变化,手动让 input 聚焦。

zlab commented 6 years ago

@ziyoung 就这样关了??

tudi2d commented 5 years ago

Why is this issue closed? I´m facing the same problem. Manually focusing elements is not a great work around...