Bug 38241 - [Win] The key event when pressing AltGr key sets altGraphKey=false
Summary: [Win] The key event when pressing AltGr key sets altGraphKey=false
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows Vista
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 76988
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-27 20:46 PDT by Hironori Bono
Modified: 2024-01-26 17:07 PST (History)
5 users (show)

See Also:


Attachments
a test case (781 bytes, text/html)
2010-04-27 20:46 PDT, Hironori Bono
no flags Details
A proposed fix (11.00 KB, patch)
2010-04-28 02:56 PDT, Hironori Bono
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hironori Bono 2010-04-27 20:46:34 PDT
Created attachment 54511 [details]
a test case

(Copied from <http://crbug.com/42627>.)

What steps will reproduce the problem?
1. Open the attached HTML file with Safari Windows (or Chrome Windows), and;
2. Press an altgraph (or right-alt) key.

Result:
The keydown event sets e.altGraphKey=false.

Expected Result:
e.altGraphKey=true. 

Is it possible to add a member function 'PlatformKeyboardEvent::altGraphKey()' so the KeyboardEvent class can set its m_altGraphKey value from a PlatformKeyboardEvent object?

Regards,

Hironori Bono
Comment 1 Hironori Bono 2010-04-28 02:56:01 PDT
Created attachment 54542 [details]
A proposed fix

Greetings,

I wrote a quick fix for this issue. Is it possible to review it and give me comments?

Regards,

Hironori Bono
Comment 2 Alexey Proskuryakov 2010-04-28 10:58:20 PDT
Did you test that this works as expected in IE? AltGr is weird, see bug 34002 for an unexpected behavior we saw before.
Comment 3 Hironori Bono 2010-04-29 05:43:50 PDT
(In reply to comment #2)
> Did you test that this works as expected in IE? AltGr is weird, see bug 34002
> for an unexpected behavior we saw before.

Thank you for your comment.
I'm afraid it is a little hard to say my change works "as expected in IE" because IE doesn't have this altGraphKey property of WebKit. IE uses altLeft property to distinguish a left-alt key and an alt-graph (right alt) key. That is, this altLeft property becomes false when we type an alt-graph (or right alt) key and becomes true whey we type a left alt key, respectively.
Even though I don't have any idea why WebKit added this altGraphKey property, my change makes altGraphKey true if altLeft is false and makes altGraphKey false if altLeft is true for compatibility with IE.

(*1) <http://msdn.microsoft.com/en-us/library/ms533076(VS.85).aspx>

As for Bug 34002, yes. an alt-graph key causes weird behaviors on Windows. So, it may be a good idea to provide a way that notifies such weird behaviors are caused by an alt-graph key. Obviously, there are some other options for this purpose: e.g. setting DOM_KEY_LOCATION_RIGHT, adding the altLeft property of IE, etc. So, it is definitely helpful to give me your thoughts about which is the best option.

Regards,

Hironori Bono
Comment 4 Alexey Proskuryakov 2010-04-29 10:14:02 PDT
This property was added in <http://trac.webkit.org/changeset/5402>, because it was present in DOM 3 Events spec at the time. It's no longer in the spec.

But my understanding is that AltGr is not the same as right Alt - event.altGraphKey should be false if one presses the right Alt key on a U.S. keyboard layout, but it should be true if the same physical key is pressed on a Polish keyboard layout. I'm not 100% sure about that, and I don't know how we can tell the difference.
Comment 5 Hironori Bono 2010-05-05 19:41:24 PDT
(In reply to comment #4)
> This property was added in <http://trac.webkit.org/changeset/5402>, because it
> was present in DOM 3 Events spec at the time. It's no longer in the spec.
> 
> But my understanding is that AltGr is not the same as right Alt -
> event.altGraphKey should be false if one presses the right Alt key on a U.S.
> keyboard layout, but it should be true if the same physical key is pressed on a
> Polish keyboard layout. I'm not 100% sure about that, and I don't know how we
> can tell the difference.

Thank you for your comment.
To read the issue list of W3C (*1), it seems W3C people dropped this altGraphKey attribute because they encourage to use the keyLocation property to distinguish a left key and a right key. I would like to cancel this review request and write another change that adds DOM_LOCATION_RIGHT to the keyLocation attribute as written in the latest DOM spec. (I don't stick to this change at all because I just would like to provide a method to distinguish a left key and a right key.)

(*1) <http://www.w3.org/2002/07/DOM-Level-3-Events-issues/issues.html#duerst19>

Sorry for bothering you with this change.

Regards,

Hironori Bono
Comment 6 Ahmad Saleem 2024-01-26 17:07:38 PST
altGraph is now gone from WebKit as well as of this commit:

https://github.com/WebKit/WebKit/commit/f1f9f0045afe3ae23d359d72658b600e4a623ac5

Nothing to do here.