Bug 135438

Summary: [test case] javascript keyboard error with konqueror at shabdkosh.com Shift, Caps, Alt, keys are undefined
Product: [Applications] konqueror Reporter: Mohd Asif Ali Rizwaan <maarizwan>
Component: khtml ecmaAssignee: Konqueror Bugs <konqueror-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: normal CC: browserbugs2, maksim
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Key event testcase

Description Mohd Asif Ali Rizwaan 2006-10-11 09:28:41 UTC
Version:           3.5.4 (using KDE 3.5.4, Frugalware Linux)
Compiler:          Target: i686-pc-linux-gnu
OS:                Linux (i686) release 2.6.18-fw1

shabdkosh.com is a English to Hindi and Hindi to English dictionary. It provides Javascript keyboard for easier text entry for users who have not setup their keyboard layout. with konquerorm pressing "Shift" key enters "Undefined" text into the lineedit.

How to Reproduce:

1. Please visit http://www.shabdkosh.com/en2hi
2. Click on the "Keyboard" button (beside Search button)
3. After clicking on the Keyboard button/link, a javascript keyboard appears
4. choose any Hindi keyboard layout from the drop-down list. (2nd or 3rd option)
5. type "k" and "Shift+k" it should get you only 2 characters. it should get you these 2 hindi characters क and ख in the "line-edit or search field." instead we get कundefinedख.

6. Now click on the search file (where the text should appear) 
7  Pressing Shift key will give "undefined"

It seems that KJS doesn't seem to handle "Shift" key properly. Moreover KJS doesn't seem to know "Caps", "Tab", "Alt", "Shift", "Del" keys.

Expected Behavior:

0. Konqueror should know the keys.
1. Firfox 1.5 handles the Caps, Tab, Alt, Shift, and Del keys appropriately.

Thanks.
Comment 1 Mohd Asif Ali Rizwaan 2006-10-11 09:31:08 UTC
You might need a Hindi Font.

http://www.kde-look.org/content/show.php?content=16645
Comment 2 kirun 2007-01-07 02:02:28 UTC
Created attachment 19144 [details]
Key event testcase

The reason this doesn't work seems to be that Konqueror sends event.which for
shift, etc. and Firefox doesn't. In the testcase, focus the first text box,
press some keys, the code appears in the second box.

The site, in kbd.js function dk, has filters for specific key events, e.g.
if (keycode ==13) return true;
However, it doesn't filter for 16, the key event for shift

Later on in the function, we have
code = eval (kbd + '[' + keycode + '-32]');

kbd is a variable containing the name of an array, so when this is eval()ed, it
will try to generate an array reference... Of course, with shift pressed, this
looks for index 16-32 , and as you can't have negative array indexes, it fails.


I think the site could easily fix its code, replacing the low keycode checks
with:
if(keycode<32) return true;
Comment 3 Konrad Rzepecki 2008-03-18 15:50:53 UTC
Moreover, "Alt" doesn't modify event.charcode which FF,IE and Opera do. When I press a,c,l with alt pressed, I get on this browsers keycodes for ą,ć,ł (Polish) on Konqueror (3.5.9) I get only zeros...
Comment 4 Philip Rodrigues 2008-04-20 23:18:07 UTC
For what it's worth, the observations in comments 2 and 3 appear to be still valid in trunk r796129
Comment 5 Gérard Talbot (no longer involved) 2011-08-16 09:02:23 UTC
KeyEvent:Properties
http://www.din.or.jp/~hagi3/JavaScript/JSTips/Mozilla/Samples/KeyEvent.htm


JavaScript Madness: Keyboard Events
http://unixpapa.com/js/key.html
states 

{
Shift, Control and Alt, that don't send characters, but modify the characters sent by other keys. For nearly all modern browsers, both keydown and keyup events are triggered by modifier keys, but keypress events are not. This is consistant with their being "key" events not "character" events. 
}


And this is exactly one wrong thing that Konqueror 4.7.0 seems to be doing: it is setting the keypress event to true when a modifier (like shift key) is pressed. 


2 interactive test pages on key events:

Keyboard events and code: Key and Character Codes vs. Event Types
http://www.w3.org/2002/09/tests/keys.html

Keyboard events and code: Key and Character Codes vs. Event Types
http://www.w3.org/2002/09/tests/keys-cancel2.html

W3C DOM 3 events
5.2.6 Keyboard Event Types 
keydown event
keypress event
keyup event
http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents

W3C DOM 3 events
6.2.2 Modifier keys
http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
also suggests that modifier keys (like Shift) should not fire a keypress event.

By the way, according to W3C DOM 3 events, keyCode, charCode and which are obsolete and have been replaced with key and char event properties.

regards, Gérard
Comment 6 Andrew Crouthamel 2018-11-06 15:15:20 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 7 Andrew Crouthamel 2018-11-18 03:37:23 UTC
Dear Bug Submitter,

This is a reminder that this bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? This bug will be moved back to REPORTED Status for manual review later, which may take a while. If you are able to, please lend us a hand.

Thank you for helping us make KDE software even better for everyone!
Comment 8 Justin Zobel 2022-12-23 00:28:32 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 9 Bug Janitor Service 2023-01-07 05:21:18 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 10 Bug Janitor Service 2023-01-22 05:05:33 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!