aboutsummaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorTatu Lund <tatu@vaadin.com>2019-08-12 14:22:38 +0300
committerZhe Sun <31067185+ZheSun88@users.noreply.github.com>2019-08-12 14:22:38 +0300
commit799345c82c4705ca9bf6a28fbc91f01d20ff75fb (patch)
treefe7512afc53b4ca46c848ec61ee61b66ba5652c1 /client/src
parent4523d31e6dffc3390366216384f9cfb72443114d (diff)
downloadvaadin-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.java8
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) {