diff options
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VTree.java | 14 | ||||
-rw-r--r-- | tests/testbench/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html | 82 |
2 files changed, 93 insertions, 3 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTree.java b/src/com/vaadin/terminal/gwt/client/ui/VTree.java index 1d5ec206aa..2d318522ea 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTree.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTree.java @@ -753,6 +753,10 @@ public class VTree extends FocusElementPanel implements Paintable, if (BrowserInfo.get().isWebkit() && !treeHasFocus) { /* * Safari may need to wait for focus. See FocusImplSafari. + * + * Note that this if/else must exactly match the one in + * fireClick() to ensure that the above click/selection event + * logic works correctly (#9136) */ // VConsole.log("Deferring click handling to let webkit gain focus..."); Scheduler.get().scheduleDeferred(command); @@ -930,13 +934,17 @@ public class VTree extends FocusElementPanel implements Paintable, details.toString(), sendClickEventNow); } }; - if (treeHasFocus) { - command.execute(); - } else { + if (BrowserInfo.get().isWebkit() && !treeHasFocus) { /* * Webkits need a deferring due to FocusImplSafari uses timeout + * + * Note that this if/else must exactly match the one in + * handleClickSelection() to ensure that the above + * click/selection event logic works correctly (#9136) */ Scheduler.get().scheduleDeferred(command); + } else { + command.execute(); } } diff --git a/tests/testbench/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html b/tests/testbench/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html new file mode 100644 index 0000000000..9593c6f6e5 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="" /> +<title>TreeItemClickAndValueChange</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">TreeItemClickAndValueChange</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/Trees?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runTrees::PID_Smenu#item0</td> + <td>19,8</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runTrees::Root/VOverlay[0]/VMenuBar[0]#item3</td> + <td>23,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runTrees::Root/VOverlay[1]/VMenuBar[0]#item0</td> + <td>38,6</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runTrees::PID_Smenu#item0</td> + <td>52,12</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runTrees::Root/VOverlay[0]/VMenuBar[0]#item3</td> + <td>53,12</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runTrees::Root/VOverlay[1]/VMenuBar[0]#item4</td> + <td>50,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runTrees::PID_StestComponent#n[0]</td> + <td>22,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runTrees::PID_StestComponent#n[1]</td> + <td>20,6</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTrees::PID_SLog_row_0</td> + <td>5. ValueChangeEvent, new value: '[Item 2]'</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTrees::PID_SLog_row_1</td> + <td>4. left click on source: [Item 1], client: [54,218];, relative: [-1,-1], itemId: Item 2, propertyId: null</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTrees::PID_SLog_row_2</td> + <td>3. ValueChangeEvent, new value: '[Item 1]'</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTrees::PID_SLog_row_3</td> + <td>2. left click on source: [], client: [56,202];, relative: [-1,-1], itemId: Item 1, propertyId: null</td> +</tr> + +</tbody></table> +</body> +</html> |