diff options
author | Anastasia Smirnova <anasmi@utu.fi> | 2018-12-17 14:55:09 +0200 |
---|---|---|
committer | Sun Zhe <31067185+ZheSun88@users.noreply.github.com> | 2018-12-17 14:55:09 +0200 |
commit | 12fe44d807404343c24caee5a1fc53ec031449c5 (patch) | |
tree | c4149362135d99e6c7f9b82233748cd662eb5e5f /shared/src/main | |
parent | a3fceafd4757c240c5871399eab008eb184ef531 (diff) | |
download | vaadin-framework-12fe44d807404343c24caee5a1fc53ec031449c5.tar.gz vaadin-framework-12fe44d807404343c24caee5a1fc53ec031449c5.zip |
Improve VMenuBar click handling logic (#11356)
* Improve VMenuBar click handling logic
During `updateFromUIDL` inside MenuBarConnector we empty and re-instantiate the components of MenuBar. When we are modifying the Menubar from the BlurEventListener of another component, we ,by this, remove widgets, therefore clickEvent is not fired and the action of the MenuItem is not proceed as a result. (The BlurEvent is fired before the click event in the chain of events. )
To improve the situation, we catch onMouseDown event , which is fired before BlurEvent,by assigning mouseDown flag to true. Then if no click event has yet happened, we delay the execution of update inside `updateFromUIDL` by default 500 ms. Then if click event occurs, it proceeds normally. The time can be increased/decreased using setter.
There is no delay, if we are clicking on the MenuBar as usual or no Blur listener is set.
This change allows setting descriptions
* Remove accidentally committed comment
* Don't update the state on the getDelayMs call
Diffstat (limited to 'shared/src/main')
-rw-r--r-- | shared/src/main/java/com/vaadin/shared/ui/menubar/MenuBarState.java | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/shared/src/main/java/com/vaadin/shared/ui/menubar/MenuBarState.java b/shared/src/main/java/com/vaadin/shared/ui/menubar/MenuBarState.java index a2854ad6be..b79b676f89 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/menubar/MenuBarState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/menubar/MenuBarState.java @@ -21,4 +21,5 @@ public class MenuBarState extends TabIndexState { { primaryStyleName = "v-menubar"; } + public int delayMs = 500; } |