mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-02 19:27:57 +08:00
IE11 Cosmetics #PL-5171
This commit is contained in:
parent
cd74794af1
commit
1656aa1a7a
@ -3,7 +3,7 @@
|
||||
* Use is subject to license terms, see http://www.cuba-platform.com/license for details.
|
||||
*/
|
||||
|
||||
project.ext.vaadinVersion = '7.3.9.cuba.12'
|
||||
project.ext.vaadinVersion = '7.3.9.cuba.14'
|
||||
|
||||
project.ext.vaadinShared = [group: 'com.vaadin', name: 'vaadin-shared', version: vaadinVersion]
|
||||
project.ext.vaadinServer = [group: 'com.vaadin', name: 'vaadin-server', version: vaadinVersion]
|
||||
|
@ -10,7 +10,6 @@ import com.google.gwt.event.dom.client.KeyCodes;
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.Event;
|
||||
import com.vaadin.client.BrowserInfo;
|
||||
import com.vaadin.client.VConsole;
|
||||
import com.vaadin.client.ui.VButton;
|
||||
|
||||
/**
|
||||
@ -28,4 +27,50 @@ public class CubaButtonWidget extends VButton {
|
||||
|
||||
super.onClick(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean handleKeyboardEvents(Event event) {
|
||||
int type = DOM.eventGetType(event);
|
||||
// Synthesize clicks based on keyboard events AFTER the normal key
|
||||
// handling.
|
||||
if ((event.getTypeInt() & Event.KEYEVENTS) != 0) {
|
||||
switch (type) {
|
||||
case Event.ONKEYDOWN:
|
||||
// Stop propagation when the user starts pressing a button that
|
||||
// we are handling to prevent actions from getting triggered
|
||||
if (event.getKeyCode() == 32 /* space */) {
|
||||
isFocusing = true;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyCodes.KEY_ENTER) {
|
||||
isFocusing = true;
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
// CAUTION IE sometimes does not generate ONKEYPRESS for ENTER, so we override default Vaadin behavior
|
||||
case Event.ONKEYUP:
|
||||
if (isFocusing) {
|
||||
if (event.getKeyCode() == 32 /* space */) {
|
||||
isFocusing = false;
|
||||
onClick();
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyCodes.KEY_ENTER) {
|
||||
isFocusing = false;
|
||||
onClick();
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ package com.haulmont.cuba.web.toolkit.ui.client.popupbutton;
|
||||
|
||||
import com.google.gwt.event.dom.client.FocusEvent;
|
||||
import com.google.gwt.event.dom.client.FocusHandler;
|
||||
import com.google.gwt.event.dom.client.KeyCodes;
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.Event;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
@ -103,4 +104,50 @@ public class CubaPopupButtonWidget extends VPopupButton {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean handleKeyboardEvents(Event event) {
|
||||
int type = DOM.eventGetType(event);
|
||||
// Synthesize clicks based on keyboard events AFTER the normal key
|
||||
// handling.
|
||||
if ((event.getTypeInt() & Event.KEYEVENTS) != 0) {
|
||||
switch (type) {
|
||||
case Event.ONKEYDOWN:
|
||||
// Stop propagation when the user starts pressing a button that
|
||||
// we are handling to prevent actions from getting triggered
|
||||
if (event.getKeyCode() == 32 /* space */) {
|
||||
isFocusing = true;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyCodes.KEY_ENTER) {
|
||||
isFocusing = true;
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
// CAUTION IE sometimes does not generate ONKEYPRESS for ENTER, so we override default Vaadin behavior
|
||||
case Event.ONKEYUP:
|
||||
if (isFocusing) {
|
||||
if (event.getKeyCode() == 32 /* space */) {
|
||||
isFocusing = false;
|
||||
onClick();
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyCodes.KEY_ENTER) {
|
||||
isFocusing = false;
|
||||
onClick();
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user