Easy keyboard shortcuts in Flow

A helper for making it easier to add keyboard shortcuts to your Vaadin Flow applications.

Event scoping

The component or element you pass in works as the scope for the event. This means that the event can come from either the component itself or any of it's children.

Simple usage

Often all that is needed is mapping a key to an action.

var messageField = new TextField();
Shortcut.add(messageField, Key.ENTER, sendButton::click);

Modifier keys

You can also add modifier keys to the shortcuts. For example, submit on Shift+Enter:

var messageField = new TextField();
Shortcut.add(messageField, Key.ENTER, sendButton::click, Key.SHIFT);

Install

Link to this version
BetaReleased 11 July 2018Apache License 2.0
Framework Support
Vaadin platform 10+
Install with
Release notes - Version 0.3.0

Supports the new perverse List with a single item implementation of Key.