Closed Bug 787144 Opened 9 years ago Closed 9 years ago

event.keycode, event.which, event.charcode always 0 on keyup event for Croatian keys, after update to firefox 15

Categories

(Core :: DOM: Events, defect)

15 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED INVALID
Tracking Status
firefox15 - ---
firefox16 - ---
firefox17 - ---
firefox18 - ---

People

(Reporter: ivan.svaljek, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0
Build ID: 20120824154833

Steps to reproduce:

We've developed a crossword puzzle for facebook, the demo url is: https://www.facebook.com/ScKrProba/app_410614592328185

Everything was working fine until upgrade to Firefox 15...


Actual results:

...then crossword's keyup event handler stopped receiving event.keycode, event.which and event.charcode, now they all equal 0 for Croatian keys(possibly for all non-ascii). Croatian keys being 'Š,Č,Ž,Đ'.


Expected results:

It should display Croatian chars when Croatian keys are pressed, as it did in all previous Firefox versions, and all other browsers.
event.keyCode has changed in Firefox 15. See the documentation here:

https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent#Virtual_key_codes
I can't find which bug that was changed in though.
The behavior is by design.

The older Firefox used native virtual keycode for DOM keyCode on Windows. However, on other platforms, we cannot convert from a character to native keycode of *Windows*. Therefore, for solving the inconsistent between platforms and internationalizing the keyCode values on other platforms, I changed the computation rules of keyCode and using the similar rules on all platforms.

So, anyway, the application must not work with Gecko on Linux and Mac even with older Firefox. Additionally, the users whose keyboard layout wasn't expected you cannot use your application.

Why are you using keyup for detecting which character is inputting? Only keypress events indicate which character is inputting by the charCode. keydown and keyup events indicate physical key state and can use only 255 key IDs for all keys on all keyboard layouts all over the world. So, keyCode cannot indicate all Unicode characters.

If your application is using <input>, I think that HTML's input event is useful for you. Otherwise, you should use keypress event instead of keyup.

(In reply to mjh563 from comment #2)
> I can't find which bug that was changed in though.

Bug 630810 for Windows. Bug 677252 for Mac. Bug 447757 for Linux.

FYI: If we can fix bug 680830, keydown.key and keyup.char will be useful for some web developers, but there are some issues in current D3E draft, so, we cannot fix it in a short time.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
Masayuki's believes this isn't a regression, and instead recommends that you use keypress instead of keyup in your application. If that doesn't resolve the problem, please re-nominate for tracking.
You need to log in before you can comment on or make changes to this bug.