

Internet Explorer is actually nice about this. For instance, the keypress event in Firefox: For these, I add charCode as ke圜ode is not always populated. Rather than shift off to OSX tonight, I take a little time to explore Firefox and Internet Explorer. Weird! There is a keypress event in this case, but the ke圜ode is a nonsensical 2! Internet Explorer does the same thing, but Firefox opts to be different here and actually does see a key press event.įinally, I try Ctrl+b with the BODY active and find: I suppose that this is because there is no character representation. Interestingly, there is no key press event in this case. Next, I try Ctrl+b with focus back in the INPUT field: There is no difference with Shift+b in the BODY either: I find that the BODY tag sees the event no differently than when the target is the INPUT field: Next up, I click outside of the INPUT so that the events will go directly to the BODY.

In this case, the key press event is also a capital “B” by virtue of my holding the Shift key while typing b. Key up/down see the uppercase key in ke圜ode regardless of any modifier keys (including the Shift key). Unlike the lowercase “b” the keycodes are all the same. There are no surprises when I type Shift + b (aka “B”): It seems that I will not be able to reliable test keyPress events in Dart just yet. Good to know since ctrl_alt_foo relies on this property when generating keyboard events. Interestingly, the keyIdentifier is blank for keyPress events. I then find that both the INPUT and BODY see the same events: In Chrome, I make the INPUT field active and type b. Ew.īefore I switch to OSX, I create a web page with simple JavaScript listeners both on an INPUT field and the BODY. I always knew this was a pain, but never fully appreciated the efforts that go into things like jQuery.īefore making wholesale changes, I am going to explore one more area of browser testing: Apple support. Browsers certainly are a pain in this respect, populating different properties, firing different events in different order (or sometime not at all). It is becoming fairly apparent that I am going to need to reconsider the approach that I take with ctrl_alt_foo, the Dart package that I am building out to handle keyboard shortcuts.
