Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 319159

Summary: Firefox and Opera traverse event not fired
Product: [RT] RAP Reporter: Jesus Luna Quiroga <jrlq>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: 1.4 M1   
Hardware: All   
OS: All   
Whiteboard:

Description Jesus Luna Quiroga CLA 2010-07-07 12:39:21 EDT
I added a traverse listener to a Text control in a view:

Text txt = new Text(this, SWT.BORDER);
txt.addTraverseListener(new TraverseListener(){
    @Override
    public void keyTraversed(TraverseEvent e) {
	ILog log = Platform.getLog(Platform.getBundle("test"));
	log.log(new Status(IStatus.INFO,"test","Traverse:"+ e));
    }			
});

The event is fired in IE, Chrome and safari but is not in Opera and Firefox.
Comment 1 Ivan Furnadjiev CLA 2010-07-08 03:16:41 EDT
This is true... I can reproduce it with CVS HEAD.
Comment 2 Ivan Furnadjiev CLA 2010-07-08 07:25:41 EDT
The Firefox problem is fixed in CVS HEAD. Firefox does not like syntax like this ( with new line after return ):
----------------
return
         widget !== null 
    && widget.getUserData( "traverseListener" ) === true;
----------------
Comment 3 Ralf Sternberg CLA 2010-07-08 15:33:12 EDT
This statement is indeed broken in Javascript.
Javascript takes a linebreak as the end of a statement if the statement is syntactically complete. As a result, this function will always return undefined after the standard. That's one of the traps explained in Douglas Crockford's "The Good Parts".
Comment 4 Ivan Furnadjiev CLA 2010-07-09 03:31:07 EDT
The Opera issue is more complex. We are using KeyEventHandlerPatch mixin to hook the qooxdoo KeyEventHandler#_idealKeyHandler. We relay on parameters sent to _idealKeyHandler (keyCode, charCode) to deal with key/traverse events. But... in some cases, qooxdoo passed 0 as keyCode and the actual key code as a charCode. This is the case with Opera. We always check the keyCode for 9 (TAB),  but it is always 0, instead of charCode which is 9. One possible solution is to use domEvent.keyCode and domEvent.charCode.
Comment 5 Ivan Furnadjiev CLA 2010-07-09 05:58:26 EDT
Opera issue is fixed too in CVS HEAD. In case of Opera client, keyCode is taken from the domEvent directly.