How do i

I am trying to implement F1 key as the shortcut to open application help but in Chrome it also opens chrome help tab. Is there any way to prevent it?

helpIconButton.addClickShortcut(Key.F1);a

No, there is no way to override intrisic browser functionalities like this. This is not Vaadin specific limitation, but applies to all web apps.

You can override at least some. Can’t check that F1, because I’m not on Windows. This at leas works with Mac+Chrome or Safari:

    clickMe.addClickShortcut(Key.KEY_P, KeyModifier.META)
            .setBrowserDefaultAllowed(false) // on mac opens print dialog without this
    ;

At least this does not override Chrome native F1 function on Windows

 Shortcuts.addShortcutListener(this, e -> Notification.show("Help"),
            Key.F1).listenOn(this).setBrowserDefaultAllowed(false);

Same here

    Button button = new Button("Help", e -> Notification.show("Help"));
    button.addClickShortcut(Key.F1).setEventPropagationAllowed(false);

Oops, I was too quick with IDE autocomplete with previous one, this one actually works

    Button button = new Button("Help", e -> Notification.show("Help"));
    button.addClickShortcut(Key.F1).setBrowserDefaultAllowed(false  );

haha, Thanks . I was hoping for some js trick but its inbuilt in vaadin. Impressive …

This is not working createBtn.addClickShortcut(Key.KEY_N, KeyModifier.CONTROL) .setBrowserDefaultAllowed(false);. And the Browser is Chrome on Windows

Everytime, it is opening a new Chrome window

If I remember correctly, at least in the past browser allowed to override some key combinations, but not all. I remember to even done a table in the past containing informations of available shorctut key combinations that are “free” for web apps. Can’t find it now though.

Seems to be the same in Safari/Mac: Key.KEY_G, KeyModifier.META can’t be made to work, but Key.KEY_P, KeyModifier.META can be overridden.