I am having a strange problem with my GWT app when running in IE8. If I hit the enter key anywhere on the app the app acts like the user has logged out and the user is returned to the login page.
This does not happen in Firefox, IE7 or IE8 running in compatibility mode.
The fact that I get returned to the login page implies that the browser has lost the session information, is making a server request and is then redirected to the login page.
If I intercept the keydown event in a widget and call preventDefault then this stops the behaviour.
Any ideas what may be causing this?
It seems that with IE8 if you do not specify the button type the button gets created as a submit button. In FF this is not the case. HTML4 standard states that if the button type is not specified it should default to being a submit button (+1 for IE!)
In IE8 if you put a submit button on a page IE8 seems to create a pseudo/hidden/secret form component at the document level.
Now, if you put any other components on the page they are treated as though they belong to the form and hitting enter in that component will fire the click event on the submit button.
This behaviour can be demonstrated with the following simple HTML.
My fix is to simply specify the button type in the GWT ui.xml file as type=”button”. This is in line with the HTML4 standard which recommends always specifying a button type to ensure compatibility across all browsers.