Results 1 to 4 of 4

Thread: Keypressed event on safari

  1. #1
    Ext User
    Join Date
    Apr 2007
    Posts
    379
    Vote Rating
    0
      0  

    Default Keypressed event on safari

    Hi,

    I am trying to trap the F1 key so I do this:
    Code:
    			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.

  2. #2
    Ext User
    Join Date
    Apr 2007
    Posts
    379
    Vote Rating
    0
      0  

    Default

    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.

  3. #3
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    6,956
    Vote Rating
    20
      0  

    Default

    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.
    Jack Slocum
    Sencha Co-Founder, Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum

  4. #4
    Ext User
    Join Date
    Apr 2007
    Posts
    379
    Vote Rating
    0
      0  

    Default

    I just thought something crazy was going on. Btw by using keydown, the problem went away.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •