diff options
author | Juho Nurminen <juho@vaadin.com> | 2013-09-23 13:17:41 +0300 |
---|---|---|
committer | Juho Nurminen <juho@vaadin.com> | 2013-10-01 11:22:23 +0300 |
commit | 478acb8e9aa7505cc6eacf219e87202191810a39 (patch) | |
tree | 132281f0011f52da98d8414bcbe1a436d878be40 | |
parent | b235d9c4e166197f3369694feec8d8f12a93c49d (diff) | |
download | vaadin-framework-478acb8e9aa7505cc6eacf219e87202191810a39.tar.gz vaadin-framework-478acb8e9aa7505cc6eacf219e87202191810a39.zip |
Check modifiers when handling TabSheet hot keys. Fixes #12178
Change-Id: I685dbf2c22e3b160632b811652bf3ab52d3ef6dc
-rw-r--r-- | client/src/com/vaadin/client/ui/VTabsheet.java | 18 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/tabsheet/TabSheetHotKeysWithModifiers.java | 50 |
2 files changed, 60 insertions, 8 deletions
diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java index fe29e2ebc0..7dec62bde0 100644 --- a/client/src/com/vaadin/client/ui/VTabsheet.java +++ b/client/src/com/vaadin/client/ui/VTabsheet.java @@ -1115,14 +1115,16 @@ public class VTabsheet extends VTabsheetBase implements Focusable, if (event.getSource() instanceof Tab) { int keycode = event.getNativeEvent().getKeyCode(); - if (keycode == getPreviousTabKey()) { - selectPreviousTab(); - } else if (keycode == getNextTabKey()) { - selectNextTab(); - } else if (keycode == getCloseTabKey()) { - Tab tab = tb.getTab(activeTabIndex); - if (tab.isClosable()) { - tab.onClose(); + if (!event.isAnyModifierKeyDown()) { + if (keycode == getPreviousTabKey()) { + selectPreviousTab(); + } else if (keycode == getNextTabKey()) { + selectNextTab(); + } else if (keycode == getCloseTabKey()) { + Tab tab = tb.getTab(activeTabIndex); + if (tab.isClosable()) { + tab.onClose(); + } } } } diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetHotKeysWithModifiers.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetHotKeysWithModifiers.java new file mode 100644 index 0000000000..c0b30ff68d --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetHotKeysWithModifiers.java @@ -0,0 +1,50 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +/** + * + */ +package com.vaadin.tests.components.tabsheet; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Label; +import com.vaadin.ui.TabSheet; + +public class TabSheetHotKeysWithModifiers extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + TabSheet tabSheet = new TabSheet(); + tabSheet.setWidth("500px"); + tabSheet.setHeight("500px"); + tabSheet.addTab(new Label("Tab 1"), "Tab 1").setClosable(true); + tabSheet.addTab(new Label("Tab 2"), "Tab 2").setClosable(true); + tabSheet.addTab(new Label("Tab 3"), "Tab 3").setClosable(true); + setContent(tabSheet); + } + + @Override + protected String getTestDescription() { + return "Hot keys (left and right arrow keys and the delete key) should be ignored when they are pressed simultaneously with modifier keys"; + } + + @Override + protected Integer getTicketNumber() { + return 12178; + } + +} |