diff options
author | John Ahlroos <john@vaadin.com> | 2013-07-26 11:07:36 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-07-26 12:53:14 +0000 |
commit | 938d4123064a99dda6b01fe0595fc83b3f76ab70 (patch) | |
tree | 744ccf958a2964b347fd1b4c0999acc2a1618861 /client | |
parent | cbab936d08b35414c4f1ce8bea55cebc53e7d4cf (diff) | |
download | vaadin-framework-938d4123064a99dda6b01fe0595fc83b3f76ab70.tar.gz vaadin-framework-938d4123064a99dda6b01fe0595fc83b3f76ab70.zip |
Fixes button :active state on firefox #12126
When doing event.preventDefault() firefox will not trigger the :active
selector intentionally (see
https://bugzilla.mozilla.org/show_bug.cgi?id=771241).
Event.preventDefault() was added to prevent text selection in #10917
but it actually is not needed since the button also uses the
user-select:none css attribute which effectivly prevents the text selection.
Also now applying the previously browser specific (ie,opera) .v-pressed
classname to all browsers to make styling of the pressed state a bit easier
to do for all browsers and not reliant on the :active pseudo-class which is a
non-standard pseudo-class.
Change-Id: Ic67c0abb9d0bf8f47b817609f2928aa8fff3e82b
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VButton.java | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/client/src/com/vaadin/client/ui/VButton.java b/client/src/com/vaadin/client/ui/VButton.java index e67fa6eceb..840ed39114 100644 --- a/client/src/com/vaadin/client/ui/VButton.java +++ b/client/src/com/vaadin/client/ui/VButton.java @@ -142,7 +142,7 @@ public class VButton extends FocusWidget implements ClickHandler { * * -for IE/Opera added CLASSNAME_PRESSED * - * -event.preventDefault() commented from ONMOUSEDOWN (Firefox won't apply + * -event.preventDefault() removed from ONMOUSEDOWN (Firefox won't apply * :active styles if it is present) * * -Tooltip event handling added @@ -189,10 +189,14 @@ public class VButton extends FocusWidget implements ClickHandler { setFocus(true); DOM.setCapture(getElement()); isCapturing = true; - // Prevent dragging (on some browsers); - event.preventDefault(); - if (BrowserInfo.get().isIE() || BrowserInfo.get().isOpera()) { - addStyleName(CLASSNAME_PRESSED); + addStyleName(CLASSNAME_PRESSED); + + if (BrowserInfo.get().isIE8() || BrowserInfo.get().isIE9()) { + /* + * We need to prevent the default behavior on these browsers + * since user-select is not available. + */ + event.preventDefault(); } } break; @@ -204,9 +208,9 @@ public class VButton extends FocusWidget implements ClickHandler { // Click ok disallowNextClick = false; } - if (BrowserInfo.get().isIE() || BrowserInfo.get().isOpera()) { - removeStyleName(CLASSNAME_PRESSED); - } + + removeStyleName(CLASSNAME_PRESSED); + // Explicitly prevent IE 8 from propagating mouseup events // upward (fixes #6753) if (BrowserInfo.get().isIE8()) { @@ -235,9 +239,7 @@ public class VButton extends FocusWidget implements ClickHandler { if (isCapturing) { } setHovering(false); - if (BrowserInfo.get().isIE() || BrowserInfo.get().isOpera()) { - removeStyleName(CLASSNAME_PRESSED); - } + removeStyleName(CLASSNAME_PRESSED); } break; case Event.ONBLUR: |