Getting error when ESC key is pressed in Firefox

135 views
Skip to first unread message

chill_hus

unread,
Jul 15, 2010, 5:42:58 AM7/15/10
to gwt-comet
Hi,
I am using gwt-comet 1.1.3 in my project and am getting an error when
ESC key is pressed
CometListener .onError called. Exception:
net.zschech.gwt.comet.client.CometException: Unexpected
disconnection. Also the flag 'connected' (which we get in onError) is
false

This happens only in Firefox, doesn't happen in IE and Safari.

Please can u help me this

thnx

Atif Mir

unread,
Jul 15, 2010, 11:20:14 AM7/15/10
to gwt-...@googlegroups.com
Hi wadia,
 
What version of FireFox r u using?

Richard Zschech

unread,
Jul 15, 2010, 9:26:04 PM7/15/10
to gwt-comet
Hi chill_hus,

When you press escape in Firefox it aborts any pending XHRs which gwt-
comet detects and raises the error.

If you want you can prevent this from happening with the following
code:

Event.addNativePreviewHandler(new NativePreviewHandler() {
@Override
public void onPreviewNativeEvent(NativePreviewEvent e) {
if (e.getTypeInt() ==
Event.getTypeInt(KeyDownEvent.getType().getName())) {
NativeEvent nativeEvent = e.getNativeEvent();
if (nativeEvent.getKeyCode() == KeyCodes.KEY_ESCAPE) {
nativeEvent.preventDefault();
}
}
}
});

I've been thinking of adding this to gwt-comet make the behaviour
consistent across browsers, but it may have other effects on
applications that use the ESC key for other purposes.

From Richard

chill_hus

unread,
Jul 16, 2010, 8:25:29 AM7/16/10
to gwt-comet
Hi Richard
thanks for ur suggestion. However i may not be able to use it as my
app uses ESC key for closing down windows.

@Atif the version of FF I am using is 3.6.6

Richard Zschech

unread,
Jul 19, 2010, 9:07:32 AM7/19/10
to gwt-comet
Hi,

Can you try the code above and see if you application ESC key handler
still gets invoked?

I've found a gwt issue which discusses this problem:

http://code.google.com/p/google-web-toolkit/issues/detail?id=2193

From Richard.

Richard Zschech

unread,
Jul 22, 2010, 8:14:23 AM7/22/10
to gwt-comet
Hi,

I've tested the above snippet of code and it does not effect other ESC
key processing on buttons and text boxes.

I will be including it in the next release.

From Richard.
Reply all
Reply to author
Forward
0 new messages