[Bug 26019] No way to initialize modifier states except "Alt", "Control", "Shift" and "Meta" at constructing DOM event with constructor

https://www.w3.org/Bugs/Public/show_bug.cgi?id=26019

--- Comment #4 from Masayuki Nakano <masayuki@d-toybox.com> ---
(In reply to Travis Leithead [MSFT] from comment #3)
> (In reply to Masayuki Nakano from comment #2)
> 1. Some of the getModifierState params duplicate existing attributes, e.g.,
> "Alt" and the altKey IDL attribute. Consequently, I've not created the new
> initializers for "Alt", but have made it explicit (in the prose for the
> existing "altKey" initializer on the dictionary) that is also sets the
> internal modifier state of the event such that calls to
> getModifierState('Alt') also return true. This avoids the duplication.

I believe that it's right approach. If D3E allows two names for a state,
following case is really a problem:

new Event("", altKey: true, modifierStateAlt: false);

So, I agree with that modifier states which can be represented by legacy fooKey
shouldn't be initialized with modifierState*.

> 2. When initializing "ctrlKey" or "metaKey" I define that the internal
> states for getModifierStates "Control" and "Meta" are set (as described
> above), but also that the virtual "Accel" modifier is also set. So
> initializing "ctrlKey" to true will cause calls to
> getModifierState("Control") and getModifierState("Accel") to also return
> true.

I think that it's not problem. Additionally, web apps can test which modifier
is the "Accel". E.g.,

var ctrlEvent = new KeyboardEvent("", { ctrlKey: true });
var metaEvent = new KeyboardEvent("", { metaKey: true });

var accelText = ctrlEvent.getModifierState("Accel") ? "Ctrl" :
                metaEvent.getModifierState("Accel") ? "Command" : ...;

Like this, web apps can show proper modifier key label dynamically.

> 3. Given #2 above, I'm going to assume that if either "ctrlKey" OR "metaKey"
> is true, then "Accel" is also true, rather than using ("ctrlKey" AND
> "metaKey") logic.

However, depending on the prefs on Firefox. Firefox can also set "Alt" or "OS"
(and "Super", "Hyper" soon) as a modifier for acceleration. Although, it must
be rare case. Anyway, modifierStateAccel should not exist in the dictionary.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 12 June 2014 18:04:43 UTC