Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Touch Premium Member suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    462
    Vote Rating
    68
    suzuki1100nz is just really nice suzuki1100nz is just really nice suzuki1100nz is just really nice suzuki1100nz is just really nice

      0  

    Default Textfield keyup event returns incorrect keycodes

    Textfield keyup event returns incorrect keycodes


    REQUIRED INFORMATION

    Ext version tested:
    • Ext 4.1.2 rev 458
    Browser versions tested against:
    • Chrome Version 25.0.1364.172 m
    • FF3 19.0.2 (firebug installed)
    DOCTYPE tested against:
    • <!DOCTYPE HTML>
    Description:
    • See code sample but keyup event object returns the incorrect key codes
    Steps to reproduce the problem:
    • Type characters into textfield and view console logs of the keycodes found for keypress versus keyup. Try * should get a single event with keycode 42 but get 2 event for keycode shift and 8
    • This may be the intended behavior of the keyup event?
    Test Case:

    Code:
    Ext.application({
      name : 'Test',
      launch : function () {
            
      var window = Ext.create('Ext.Window',{
        height : 400,
        width : 500,
        title : 'Test ExtJS',
        items : [{
            xtype : 'textfield',
            fieldLabel : 'Test keyup',
                    width : 300,
            margin : '10 0 0 10',
            listeners : {
                keypress : {
                    element : 'el',
                    fn : function(ev, el, eOpts){
                          console.log("Keypress keycode: " + ev.getKey() + "  char: " + String.fromCharCode(ev.getKey()));
                    }
                },
                keyup : {
                    element : 'el',
                    fn : function(ev, el, eOpts){
                          console.log("Keyup keycode: " + ev.getKey() + "  char: " + String.fromCharCode(ev.getKey()));
                                        
                         }
                     }
                     }
                     }]
        });
        window.show();
    }
    });

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,146
    Vote Rating
    673
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    At this point we're just relaying the browser events. There's some good info on it here:

    http://www.quirksmode.org/js/keys.html
    http://unixpapa.com/js/key.html
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Touch Premium Member suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    462
    Vote Rating
    68
    suzuki1100nz is just really nice suzuki1100nz is just really nice suzuki1100nz is just really nice suzuki1100nz is just really nice

      0  

    Default


    Any reason why Sencha doesnt wrap the keyup (Event object) and set the correct keycode?
    i.e. based on the keycode combined with the modifiers - ctrlKey and shiftKey and altKey?

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,146
    Vote Rating
    673
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    The main reason is keyboard layout. How do I know that shift + 3 is "#"?

    http://en.wikipedia.org/wiki/File:KB_United_Kingdom.svg
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Touch Premium Member suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    462
    Vote Rating
    68
    suzuki1100nz is just really nice suzuki1100nz is just really nice suzuki1100nz is just really nice suzuki1100nz is just really nice

      0  

    Default


    Ok thanks - so until there is a nice way to detect keyboard layout and the various browsers can get some consistency, keyup and keydown are a waste of time.
    Ill stick to keypress.
    Thanks for all the info Evant.


    Quote Originally Posted by evant View Post
    The main reason is keyboard layout. How do I know that shift + 3 is "#"?

    http://en.wikipedia.org/wiki/File:KB_United_Kingdom.svg

Thread Participants: 1