Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334504 - Traverse event with detail = TRAVERSE_RETURN not fired in IE, Safari and Chrome
Summary: Traverse event with detail = TRAVERSE_RETURN not fired in IE, Safari and Chrome
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.4 M5   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 329926
  Show dependency tree
 
Reported: 2011-01-17 04:52 EST by Ivan Furnadjiev CLA
Modified: 2011-01-18 08:17 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Furnadjiev CLA 2011-01-17 04:52:01 EST
When you press ENTER key on a control, TraverseEvent with detail = TRAVERSE_RETURN should be fired. This works in Firefox, but not in the browsers that use sync key events (IE, Safari, Chrome and Opera). The reason for it is that for these browsers the keyCode filed send from the browser is 0, but charCode is 13. In FF keyCode = 13, charCode=0. Thus, ControlLCAUtil#processKeyEvents determine the traverseKey as SWT.TRAVERSE_NONE, as it is taken from keyCode field only. As a result no TraverseEvent is fired.
Snippet:
    Text text = new Text( parent, SWT.SINGLE | SWT.BORDER );
    text.addKeyListener( new KeyListener() {
      public void keyPressed( final KeyEvent e ) {
        System.out.println( "keyPressed:" + e );
      }
      public void keyReleased( final KeyEvent e ) {
        System.out.println( "keyReleased:" + e );
      }
    } );
    text.addTraverseListener( new TraverseListener() {
      public void keyTraversed( TraverseEvent e ) {
        System.out.println( "keyTraversed:" + e );
      }

    } );
To reproduce, press ENTER key in the text filed. KeyEvents are fired, but not the TraverseEvent.  Works fine in Firefox.
This functionality is needed to prevent the default button in the cell editors - see bug 329926.
Comment 1 Tim Buschtoens CLA 2011-01-18 08:17:23 EST
Fixed in CVS HEAD by updating EventHandlerUtil#getKeyCode and getCharCode