diff options
author | Tatu Lund <tatu@vaadin.com> | 2019-08-12 14:22:38 +0300 |
---|---|---|
committer | Zhe Sun <31067185+ZheSun88@users.noreply.github.com> | 2019-08-12 14:22:38 +0300 |
commit | 799345c82c4705ca9bf6a28fbc91f01d20ff75fb (patch) | |
tree | fe7512afc53b4ca46c848ec61ee61b66ba5652c1 /client/src | |
parent | 4523d31e6dffc3390366216384f9cfb72443114d (diff) | |
download | vaadin-framework-799345c82c4705ca9bf6a28fbc91f01d20ff75fb.tar.gz vaadin-framework-799345c82c4705ca9bf6a28fbc91f01d20ff75fb.zip |
Add explicit handling of ctrl-a (#11693)
* Add explicit handling of ctrl-a
Fixes https://github.com/vaadin/framework/issues/11678
* Adds test case and formatting the code
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java b/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java index 97167847a5..6cbdb944ec 100644 --- a/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java +++ b/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java @@ -563,6 +563,14 @@ public class VTwinColSelect extends Composite implements MultiSelectWidget, public void onKeyDown(KeyDownEvent event) { int keycode = event.getNativeKeyCode(); + // Catch Ctrl-A and select all items since other browsers + // than Chrome do not handle this natively + if (event.isControlKeyDown() && (keycode == KeyCodes.KEY_A)) { + for (int i = 0; i < optionsListBox.getItemCount(); i++) { + optionsListBox.setItemSelected(i, true); + } + } + // Catch tab and move between select:s if (keycode == KeyCodes.KEY_TAB && event.getSource() == optionsListBox) { |