Hi,
I stumbled upon a little difference in the keyboard handling. I have a NativeSelect connected as follows:
reportTypeNS = new NativeSelect(null, Arrays.asList(reportTypes));
reportTypeNS.setNullSelectionAllowed(false);
reportTypeNS.setImmediate(true);
reportTypeNS.addListener(this);
...
public void valueChange(ValueChangeEvent event)
{
if (event.getProperty() == reportTypeNS)
{
// react on selected report type via event.getProperty().getValue();
...
}
}
The difference I found is, that the event listener is not always called when the selection of the NativeSelect is changed with the
keyboard up/down keys
. Some browsers need to press
ENTER
after the selection has changed.
IE9: triggers event with up/down keys (ok)
Safari 5.1.2: triggers event ONLY when
ENTER
is pressed after selection has changed
Chrome 16.0.912.77: triggers event ONLY when
ENTER
is pressed after selection has changed
Opera 11.61: triggers event with up/down keys (ok)
Firefox 9.0.1: triggers event ONLY when
ENTER
is pressed after selection has changed
A similar effect happens when the user pressed the ENTER key inside a TextField:
searchTF = new TextField();
searchTF.setImmediate(true);
searchTF.addShortcutListener(new AbstractField.FocusShortcut(searchTF,
ShortcutAction.KeyCode.S, ShortcutAction.ModifierKey.ALT,
ShortcutAction.ModifierKey.SHIFT));
searchTF.addListener(this);
...
public void valueChange(ValueChangeEvent event)
{
if (event.getProperty() == searchTF)
{
// react on search word via event.getProperty().getValue();
...
}
}
Here the difference is, that Opera need the
TAB key pressed
in order to trigger the event.
IE9: triggers event with enter keys (ok)
Safari 5.1.2: triggers event with enter keys (ok)
Chrome 16.0.912.77: triggers event with enter keys (ok)
Opera 11.61: triggers event
ONLY
when TextField loses focus (i.e. via TAB key)
Firefox 9.0.1: triggers event with enter keys (ok)
I don’t know if this different behaviour is done on purpose, but I think it should be the same on all browsers. That’s one of the main reasons why we choosed Vaadin
Regards
Andreas