RE: Shortcut key could not be added twice

Hi,

the shortcut key is bound to the closest panel, UI or Window when you go upwards in the hierarchy. You could wrap both fields in separate panels to make this work butt a simpler way might be to use https://vaadin.com/directory/component/keyactions instead. This add-on allows you to bind the enter listener to the field itself and not a parent UI/Panel/Window

I have two textfield in my page.
One is as following:

  tfBarcode.addShortcutListener(new ShortcutListener("enter", KeyCode.ENTER, null) {
   private static final long serialVersionUID = -3253324368590431146L;
   @Override
   public void handleAction(Object sender, Object target) {
    if (target.equals(tfBarcode)) {
     start();
    }
   }
  });


another:

 [code]
 tfScanedSN.addShortcutListener(new ShortcutListener("sfs",KeyCode.ENTER,null) {
   /**
    *
    */
   private static final long serialVersionUID = 1L;
   @Override
   public void handleAction(Object sender, Object target) {
    if(target.equals(tfScanedSN)) {
     System.out.println("assembly received");
    }
   }
  });
[/code]

I found the second “tfScanedSN” could never run its listener after the ENTER is clicked. It will call the listener of “tfBarcode” twice with the “target” parameter sepcified with the “tfScanedSN”.

Andybody know this issue.
By the way, I am using 8.1.7.

thank you very much, I will have a try.