diff options
author | Denis Anisimov <denis@vaadin.com> | 2014-09-07 21:06:59 +0300 |
---|---|---|
committer | Sauli Tähkäpää <sauli@vaadin.com> | 2014-09-12 11:32:08 +0300 |
commit | 9126b9fc10b3fc5b3b71527073262c07dfc066a5 (patch) | |
tree | b9508ca0b035392677f5e158c275cd6d5967b6c4 /client | |
parent | 84038225ac71d56d21887a338e5daa8994a76eed (diff) | |
download | vaadin-framework-9126b9fc10b3fc5b3b71527073262c07dfc066a5.tar.gz vaadin-framework-9126b9fc10b3fc5b3b71527073262c07dfc066a5.zip |
Pass (x,y) coordinates for button click triggered via keyboard (#12650).
Change-Id: I24363d34f7007650fc66f9b85d7e22a4ab10bb6b
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VButton.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/ui/VButton.java b/client/src/com/vaadin/client/ui/VButton.java index 7dfb5c7c86..2e5494ec18 100644 --- a/client/src/com/vaadin/client/ui/VButton.java +++ b/client/src/com/vaadin/client/ui/VButton.java @@ -351,9 +351,16 @@ public class VButton extends FocusWidget implements ClickHandler { disallowNextClick = false; - // Mouse coordinates are not always available (e.g., when the click is + // Screen coordinates are not always available (e.g., when the click is // caused by a keyboard event). - NativeEvent evt = Document.get().createClickEvent(1, 0, 0, 0, 0, false, + // Set (x,y) client coordinates to the middle of the button + int x = getElement().getAbsoluteLeft() - getElement().getScrollLeft() + - getElement().getOwnerDocument().getScrollLeft() + + Util.getRequiredWidth(getElement()) / 2; + int y = getElement().getAbsoluteTop() - getElement().getScrollTop() + - getElement().getOwnerDocument().getScrollTop() + + Util.getRequiredHeight(getElement()) / 2; + NativeEvent evt = Document.get().createClickEvent(1, 0, 0, x, y, false, false, false, false); getElement().dispatchEvent(evt); } |