Jump to content
Sign in to follow this  

[FIXED] Alpha: Edit Box key press keycode differences

Recommended Posts

This is, what I wrote on the Smart Mobile Studio Facebook page a while ago:


Some people are just way too pedantic. While testing I noticed that my Android phone did not trigger OnKeyPress. While investigating I found a lot of Google hits on the same problem. As people can speak to input text or write multi-char smileys, someone thought that it's a great idea to deprecate an event, that has been used ever since computers had more than 1 MB of memory.

There were a lot of suggestions on how to work around this. Many suggest to use OnInput (which will be introduced in the next update, along this fix), but basically only one browser included the pressed key in the event. Some suggested to store the text at OnKeyDown and to compare the contents at OnKeyUp.

Long story short: In the future we'll listen to both OnKeyPress and OnInput. If OnKeyPress was not triggered or the key was not found, we try to find the key during OnInput. If we do find it, we simulate a OnKeyPress.

Oh, and OnKeyPress contains the changed key. But what happens when you write a smiley on mobile? The whole smiley is sent even though it's longer than one character. If someone thinks that's a problem, please do smile more 1f642.png

Works in all browsers, iOS, Android and Windows mobile.

Now, when you press enter, you actually don't get 69. You get five characters: 69, 110, 116, 101, 114

When you print those characters, it's spelled out: Enter

Now, well... I suppose I could convert that internally to #13 :-)

Share this post

Link to post
Share on other sites
3 minutes ago, recursiveElk said:

Yeah any solution works and i've seen a lot of debate on either side of chromium forums on the issue. Just wanted to alert for the sake of consistency moving forward. 

Thank you for doing it. I appreciate it. The aim of SMS is to solve all these kinds of issues and differences inside the RTL so that programmers don't have to write platform specific code. So I'll be more than happy to test and fix any issues like these :-)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this