Problem searching list with Hebrew/Arabic filter #2834

Closed
odedbd opened this Issue Oct 25, 2011 · 5 comments

Comments

Projects
None yet
4 participants

odedbd commented Oct 25, 2011

Hello all,

I have an issue with using the search/filter feature of a list on my Galaxy S, no fiddle/bin necessary, as the problem may be reproduced with the official docs page - http://jquerymobile.com/demos/1.0rc2/docs/lists/lists-search.html

Just try typing in Hebrew or Arabic (And most likely other languages which are not English, I only tested these), and the filtering will not take place after each key press, but rather only after you type some symbol such as a period, a comma or a spacebar. I assume that the distinction here might be between symbols which are or are not part of the basic ASCII keys.

I debugged this a little, and it seems that typing simply doesn't trigger the keydown/up events for these languages. I don't know if the problem lies in the triggering of the events, or in the binding, but the end result is as I described. The problem is not specific to JQM, and was present in all previous versions I tested (alpha3 onward), but it critically impacts this feature of the framework, so I thought it appropriate to submit the issue here.

I can think of ways to bypass this using a watchdog mechanism (with timeout), but a cleaner solution would be better, if one can be had.

Thanks,
o

Contributor

toddparker commented Oct 26, 2011

So is this a bug with Android? If you remove jQM from the code, can you get the browser to register a keyup/down event? If not, then I'm not sure what we can do unless there is a different event to try.

odedbd commented Oct 26, 2011

Yeah, it is a bug with Android, or at least with jQuery not catching the keydown/up/press events. However, I did find that the "input" event is triggered, so perhaps that could be used as a fallback for the search.

I guess a complete fix will only come with a new Android browser (way belated already), but there might be a workaround. I didn't manage to find it myself, but I am not the JS Ninja that the good people of JQM generally are, and I thought this is something that many developers working in non-english speaking markets might appreciate.

It's a bug of Android, not jQuery (even not default browsers don't fire onkeyup events for russian, korean, hebrew, etc.)
thnx to odedbd with hint of "input" event, finally I made this change in jquery.mobile-1.1.1.js

        .jqmData( "lastval", "" )
        .bind( "keyup change input", function() {

instead of

        .jqmData( "lastval", "" )
                .bind( "keyup change", function(){

and now element works as expected

Member

jaspermdegroot commented Sep 24, 2012

@rmanempire - Thanks!

Looks pretty safe to me to add input. Will give this a look for 1.2.1. [update: for 1.1.2]

Member

jaspermdegroot commented Dec 3, 2012

Closing as fixed by commit a743616.

@odedbd - Can you please confirm the issue has been fixed. Thanks!

Update: you can test latest on this page http://jquerymobile.com/test/docs/lists/lists-search.html

@jaspermdegroot jaspermdegroot added a commit that referenced this issue Dec 3, 2012

@jaspermdegroot jaspermdegroot Textinput: Toggle clear button on input event as well.
Fixes problems with multibyte. See issues #1811 and #2834.
ba9bcce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment