How to add shortcut listeners for two text fields with same key code ?

I try to add shortcut on enter for two text fields on one screen, but always first is called:

tf1.addShortcutListener(new ShortcutListener("enter", com.vaadin.event.ShortcutAction.KeyCode.ENTER, null) {
            @Override
            public void handleAction(Object sender, Object target) {
            }
});

tf2.addShortcutListener(new ShortcutListener("enter", com.vaadin.event.ShortcutAction.KeyCode.ENTER, null) {
            @Override
            public void handleAction(Object sender, Object target) {
            }
});

Hi,

the shortcut listeners are scoped to window/ui or panel. So if you want the same shortcut for two textfields, try wrapping them in Panels. That should make it work. Use a light styled panel in order to not interfere with the looks of your app.