PDA

View Full Version : Keypressed event on safari



sfwalter
15 Apr 2007, 3:59 PM
Hi,

I am trying to trap the F1 key so I do this:


Ext.get(document).on("keypress", function(e) {
if(e.getKey()==112) {
alert('f1');
}
}, this);


It works fine on firefox, but in Safari it doesn't work at all. Do I need to use a different event for Safari?


Thanks in advance. Scott.

sfwalter
15 Apr 2007, 5:36 PM
Oh this is weird on Firefox 112 is being trigged when either "F1" or the letter "p" is pressed. On Safari only the "p" triggers the code.

scott.

jack.slocum
15 Apr 2007, 9:59 PM
Why would this be an Ext bug? In Safari keypress event is always messed up for special keys. We remap many to normalize them but not all (we don't touch F keys, you get what the browser reports).

On a side note, keydown is more consistent across browsers.

sfwalter
16 Apr 2007, 4:27 AM
I just thought something crazy was going on. Btw by using keydown, the problem went away. :)