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

Popup <input> doesn't loose focus #5706

Closed
vkammerer opened this Issue Feb 27, 2013 · 20 comments

Comments

Projects
None yet
@vkammerer

Hello JQM community,

After opening a popup including form elements like input and textarea (only types tested so far) and giving the focus to one of these elements, it is impossible to loose focus again, unless your close the popup.

This bug is visible on the current Demo center.

Steps to reproduce:
1 - go to the popup page of the demo center:
http://view.jquerymobile.com/master/docs/widgets/popup/
2 - Scroll down to the Form section and click the "Sign In" button
3 - Set focus to one of the input fields.
4 - Try to click somewhere else in the popup: You can't loose focus again!

Tested on:

  • Desktop: Windows 7 / Chrome Canary
  • Mobile: Galaxy Note 2 / Android 4.1.2 / Webview (Phonegap)
@agcolom

This comment has been minimized.

Show comment
Hide comment
@agcolom

agcolom Feb 27, 2013

Member

@vkammerer I am not experiencing this issue but I have a different setting from yours.

Working fine on:
Desktop: OS X 10.6.8 FF18.0.2, Safari 5.1.7 and Chrome 25.0.1364.99
Mobile: iPod Touch iOS 5.0.1

Member

agcolom commented Feb 27, 2013

@vkammerer I am not experiencing this issue but I have a different setting from yours.

Working fine on:
Desktop: OS X 10.6.8 FF18.0.2, Safari 5.1.7 and Chrome 25.0.1364.99
Mobile: iPod Touch iOS 5.0.1

@vkammerer

This comment has been minimized.

Show comment
Hide comment
@vkammerer

vkammerer Feb 27, 2013

@agcolom thanks for the reply!

I did more testing and I could reproduce the bug on all environments:

on Galaxy Note 2 / Android 4.1.2:

  • up to date Chrome.
  • Android Stock browser.
  • Webview.

on desktop / Windows 7:

  • Safari 5.1
  • Firefox 18.0
  • Chrome 25.0.1364.97 m

If you first click on an input field and then click somewhere else in the popup (like on the "Please sign in" h3), do you loose the focus on the input?

Moreover, I noticed that if you first open a popup, set focus to one of its fields, close the popup by clicking outside, and then open the same popup again, it will automatically set focus to the input after 1 or 2 seconds.

@agcolom thanks for the reply!

I did more testing and I could reproduce the bug on all environments:

on Galaxy Note 2 / Android 4.1.2:

  • up to date Chrome.
  • Android Stock browser.
  • Webview.

on desktop / Windows 7:

  • Safari 5.1
  • Firefox 18.0
  • Chrome 25.0.1364.97 m

If you first click on an input field and then click somewhere else in the popup (like on the "Please sign in" h3), do you loose the focus on the input?

Moreover, I noticed that if you first open a popup, set focus to one of its fields, close the popup by clicking outside, and then open the same popup again, it will automatically set focus to the input after 1 or 2 seconds.

@vkammerer

This comment has been minimized.

Show comment
Hide comment
@vkammerer

vkammerer Feb 27, 2013

@agcolom I am only reading now the description of the component : "You can place a form inside a popup. When it opens, focus will be restricted to elements inside the popup."

So it seems that this component is behaving so by design and that this is not a bug.

I'm a bit dubious about this behaviour though, as it can be interesting to place other elements in popups that can be focused.

@agcolom I am only reading now the description of the component : "You can place a form inside a popup. When it opens, focus will be restricted to elements inside the popup."

So it seems that this component is behaving so by design and that this is not a bug.

I'm a bit dubious about this behaviour though, as it can be interesting to place other elements in popups that can be focused.

@vkammerer

This comment has been minimized.

Show comment
Hide comment
@vkammerer

vkammerer Feb 27, 2013

@agcolom actually, this is a bug:

the description says:
"focus will be restricted to elements inside the popup"

but it doesn't say
"focus cannot be lost inside the popup"

The behaviour I am experiencing in my Android Phonegap app is that the soft keyboard keeps popin after setting focus to a field inside a popup. I am sure this can't be so by design.

@agcolom actually, this is a bug:

the description says:
"focus will be restricted to elements inside the popup"

but it doesn't say
"focus cannot be lost inside the popup"

The behaviour I am experiencing in my Android Phonegap app is that the soft keyboard keeps popin after setting focus to a field inside a popup. I am sure this can't be so by design.

@agcolom

This comment has been minimized.

Show comment
Hide comment
@agcolom

agcolom Feb 27, 2013

Member

@vkammerer I get what you mean now. Sorry I thought that you could not lose focus on a previously focused input filed inside a a popup. Yes, it seems that the only way to lose focus on an input field inside a popup is to click/tap inside another input field and get that new one into focus. So if this is what you meant, then I can reproduce :-)

@uGoMobi Is that something that we can look at? Outside of popups, tapping/clicking outside of a previously selected (in focus) input field, tapping/clicking outside of that input field will cause it not to be in focus anymore. However, inside the popup, this is not happening. So if you have tapped/clicked inside a form element inside a popup, clicking outside of that form element in the popup will not allow this input field to lose focus (except if you click inside another form element on the popup, but then the problem is just passed to another form element, and so not resolved)

Member

agcolom commented Feb 27, 2013

@vkammerer I get what you mean now. Sorry I thought that you could not lose focus on a previously focused input filed inside a a popup. Yes, it seems that the only way to lose focus on an input field inside a popup is to click/tap inside another input field and get that new one into focus. So if this is what you meant, then I can reproduce :-)

@uGoMobi Is that something that we can look at? Outside of popups, tapping/clicking outside of a previously selected (in focus) input field, tapping/clicking outside of that input field will cause it not to be in focus anymore. However, inside the popup, this is not happening. So if you have tapped/clicked inside a form element inside a popup, clicking outside of that form element in the popup will not allow this input field to lose focus (except if you click inside another form element on the popup, but then the problem is just passed to another form element, and so not resolved)

@vkammerer

This comment has been minimized.

Show comment
Hide comment
@vkammerer

vkammerer Feb 27, 2013

@agcolom thanks! your question to @uGoMobi is exactly what I was trying to explain :-)

@agcolom thanks! your question to @uGoMobi is exactly what I was trying to explain :-)

@jaspermdegroot

This comment has been minimized.

Show comment
Hide comment
@jaspermdegroot

jaspermdegroot Feb 27, 2013

Member

@gabrielschulhof - Can you weigh in here? Thanks!

Member

jaspermdegroot commented Feb 27, 2013

@gabrielschulhof - Can you weigh in here? Thanks!

@gabrielschulhof

This comment has been minimized.

Show comment
Hide comment
@gabrielschulhof

gabrielschulhof Feb 28, 2013

Contributor

@vkammerer Could you please verify that this fix results in the popup behaviour you desire?

Contributor

gabrielschulhof commented Feb 28, 2013

@vkammerer Could you please verify that this fix results in the popup behaviour you desire?

gabrielschulhof added a commit that referenced this issue Feb 28, 2013

Popup: When focusing on the container, do not bounce focus to an elem…
…ent inside it even if such an element is available. Fixes #5706.

(cherry picked from commit c605423)
@vkammerer

This comment has been minimized.

Show comment
Hide comment
@vkammerer

vkammerer Feb 28, 2013

@gabrielschulhof it's all good now, thanks!

@gabrielschulhof it's all good now, thanks!

@eshangin

This comment has been minimized.

Show comment
Hide comment
@eshangin

eshangin Mar 12, 2013

I had the same problem on IPhone. Thanks a lot!

I had the same problem on IPhone. Thanks a lot!

@borgy3377

This comment has been minimized.

Show comment
Hide comment
@borgy3377

borgy3377 Feb 2, 2015

Hi, this problem seems to have come up again in 1.4.5. Working okay in 1.3.2.

Platforms - Safari iOS 8.1.2 (iPad) and Chrome 40.0.2214.93 (Win32).Thanks. Daniel.

Hi, this problem seems to have come up again in 1.4.5. Working okay in 1.3.2.

Platforms - Safari iOS 8.1.2 (iPad) and Chrome 40.0.2214.93 (Win32).Thanks. Daniel.

@borgy3377

This comment has been minimized.

Show comment
Hide comment
@borgy3377

borgy3377 Feb 4, 2015

After further investigation, it looks like this issue did not exist in 1.4.4. This is really annoying especially if the first element inside the popup is a select. Thanks. Daniel.

After further investigation, it looks like this issue did not exist in 1.4.4. This is really annoying especially if the first element inside the popup is a select. Thanks. Daniel.

@matpag

This comment has been minimized.

Show comment
Hide comment
@matpag

matpag May 11, 2015

i have the same problem with 1.4.5, cant loose focus of input popup without clicking another input field...

matpag commented May 11, 2015

i have the same problem with 1.4.5, cant loose focus of input popup without clicking another input field...

@borgy3377

This comment has been minimized.

Show comment
Hide comment
@borgy3377

borgy3377 May 11, 2015

Hi Soulcyber, we just ended out using 1.4.4. It may not be the ideal solution and I'm sure it can be worked around but everything else in our application works okay now. Thanks. Daniel.

Hi Soulcyber, we just ended out using 1.4.4. It may not be the ideal solution and I'm sure it can be worked around but everything else in our application works okay now. Thanks. Daniel.

@matpag

This comment has been minimized.

Show comment
Hide comment
@matpag

matpag May 12, 2015

Thanks Daniel 👍

matpag commented May 12, 2015

Thanks Daniel 👍

@mkattner

This comment has been minimized.

Show comment
Hide comment
@mkattner

mkattner Jan 11, 2016

Is there a solution for 1.4.5?

Is there a solution for 1.4.5?

@mkattner

This comment has been minimized.

Show comment
Hide comment
@mkattner

mkattner Jan 11, 2016

I removed ui.focusElement.focus(); and it works fine for me. But is this the right solution?

I removed ui.focusElement.focus(); and it works fine for me. But is this the right solution?

@cepm-nate

This comment has been minimized.

Show comment
Hide comment
@cepm-nate

cepm-nate Feb 22, 2016

mkattner, this is at line 10558 in jquery.mobile-1.4.5.js, right?

mkattner, this is at line 10558 in jquery.mobile-1.4.5.js, right?

@harryizquierdo

This comment has been minimized.

Show comment
Hide comment
@harryizquierdo

harryizquierdo Sep 8, 2016

Muchas gracias si me sirvió.

Muchas gracias si me sirvió.

@Domain

This comment has been minimized.

Show comment
Hide comment
@Domain

Domain Nov 2, 2017

@gabrielschulhof Please reopen this for 1.4.5

Domain commented Nov 2, 2017

@gabrielschulhof Please reopen this for 1.4.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment