Input text disappears when focused in Opera Mini #4311

Closed
evgenyneu opened this Issue May 7, 2012 · 19 comments

6 participants

@evgenyneu

To recreate, open the following example in Opera Mini and tap the text field:
http://jsfiddle.net/evgenyneu/fwASH/12/

Here is an example where jQueryMobile is not used and text input works ok:
http://jsfiddle.net/evgenyneu/WB7yg/2/

Tested in iOS 5.1, Opera Mini 7.0.1.32694

@agcolom
jQuery Foundation member

@evgenyneu could you please try again with http://jsfiddle.net/agcolom/fwASH/13/ (I wonder if it was because you were using jQuery 1.6.4. I have updated your code to use 1.7.1

@evgenyneu

@agcolom, thanks. I have tested your fiddle, no improvements. The text still disappears.

@agcolom
jQuery Foundation member
@evgenyneu

@agcolom no, same bug here. Does not matter if input is inside a form or has a label. The input text still disappears when it is focused. This is really annoying when editing an existing form in Opera Mini. I need to re-enter previous values if I want to slightly change them in text inputs.

Thanks for the tests.

@jaspermdegroot
jQuery Foundation member

When I unbind every event/handler attached to the input field it works as expected. I know JQM registers dummy handlers on elements for browsers like Opera Mini. Maybe we can find the cause of the issue there.

@toddparker

I just tested this docs page on an iPad 3 running 5.1.1 and an iPhone 4S running iOS 5.1.1, both running Opera 7.0.1 (latest) and every text input seems to work fine:
http://jquerymobile.com/test/docs/forms/textinputs/

@evgenyneu - can you confirm that you're seeing an issue on this page in the docs? If not, I think there must be something up with that code sample. It must be in a form and have a properly associated label as a baseline as @agcolom suggested.

@evgenyneu

@toddparker This issue can not be seen on the text inputs docs page because text inputs have no initial values there.

The issue only appears in text inputs with initial text value. This text disappears when you focus the input.

It works fine, however, if you first enter text, unfocus and then focus the input. This is why the docs page does not reveal the bug.

Text areas do not have this issue, only text inputs.

@evgenyneu

I think I caught it. It is a bug in Opera Mini. It appears when text input has 'onfocus' event bound.

Here is live test that does not use jQuery or jQueryMobile:

http://jsfiddle.net/evgenyneu/XWhhF/7/embedded/result/

I have reported this bug to Opera.

Does is make sense to create a special case in jQueryMobile and prevent focus event binding just for Opera Mini?

@MauriceG

Hi !
I've tested this with the opera mini emulator on Windows and the issue does not appear.
Just on iPad it looks like opera creates a second input above the form input to add some markup like a clear button. If you leave the item without any change the value is still in the form input.

@jaspermdegroot
jQuery Foundation member

@evgenyneu

Can you test if adding this script to your jQuery Mobile project solves the issue?

$(document).bind( "pageinit", function() {
  if ( window.operamini ) { $('input[type="text"]').unbind('focus'); }
});

BTW - The issue did appear while testing on the online Opera Mini (6.5) simulator on Windows. @MauriceG did you use that one as well or an installed emulator?

@evgenyneu

@uGoMobi yes, it fixes the problem, thank you.

Here is a live test with this fix: http://jsfiddle.net/evgenyneu/fd2fq/10/embedded/result/

@jaspermdegroot
jQuery Foundation member

@evgenyneu
Ok, thanks for reporting back. Please note that I haven't looked into possible downsides of this quick fix.

@toddparker
I can confirm the issue: On Opera Mini when a text input has an initial value this disappears on focus. The cause is an Opera Mini bug, which is triggered by jQuery Mobile binding handlers to the focus event.

I am not sure about how to implement a fix for this in the code. Maybe you can ask someone else to look into it.

@MauriceG

Hi @uGoMobi
Sorry for delay. I use the installed opera emulator and had switched off the focus event already in local repo for testing on iPad. I've reverted the change and the emulator does not show this issue, as described.
Maurice

@toddparker

Yep, I can reproduce this too. I had missed the part about the value being set. Pretty bad regression for such a common thing. I just asked @miketaylr from Opera about how to handle this. I really dislike having to add such specific UA style code to fix a browser regression so I want to see if this kind of thing can be fixed on the server (proxy) side or if it's in the app before we think about next steps.

@miketaylr

@evgenyneu can you give me the bug report number that you filed?

@toddparker this could be fixed server-side, AFAICT.

@toddparker

@miketaylr Yeah buddy! Proxy shenanigans FTW. That is great news.

@evgenyneu

@miketaylr Opera bug report ID is DEVNULL-207

@toddparker

We'll wait to hear back from @miketaylr on if/when this is resolved by Opera on the proxy side of things.

@jaspermdegroot
jQuery Foundation member

I am closing this ticket because it's a bug in Opera Mini as the test page without jQuery Mobile shows. There is nothing we can do here..

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