| Summary: | Firefox and Opera traverse event not fired | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Jesus Luna Quiroga <jrlq> |
| Component: | RWT | Assignee: | 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: | |||
This is true... I can reproduce it with CVS HEAD. 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;
----------------
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". 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. Opera issue is fixed too in CVS HEAD. In case of Opera client, keyCode is taken from the domEvent directly. |
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.