summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorMikael Grankvist <mgrankvi@vaadin.com>2014-09-04 15:01:20 +0300
committerVaadin Code Review <review@vaadin.com>2014-09-05 06:57:39 +0000
commite38a4c3e21f3fcefe658216f769dd7b0c6c36383 (patch)
treecc03684668dca5ada1bfb451447d30f34974a284 /client
parent51bd03c8295c974344775d9d5cc1914ed68a3290 (diff)
downloadvaadin-framework-e38a4c3e21f3fcefe658216f769dd7b0c6c36383.tar.gz
vaadin-framework-e38a4c3e21f3fcefe658216f769dd7b0c6c36383.zip
Override IE disabled style for text field (#14565)
Change-Id: Ie48e56666c43450c47015067879fdc604c7ac843
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/VPopupCalendar.java38
-rw-r--r--client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java2
2 files changed, 36 insertions, 4 deletions
diff --git a/client/src/com/vaadin/client/ui/VPopupCalendar.java b/client/src/com/vaadin/client/ui/VPopupCalendar.java
index 1474ad3b71..577e267d3b 100644
--- a/client/src/com/vaadin/client/ui/VPopupCalendar.java
+++ b/client/src/com/vaadin/client/ui/VPopupCalendar.java
@@ -240,7 +240,23 @@ public class VPopupCalendar extends VTextualDate implements Field,
*/
public void setTextFieldEnabled(boolean textFieldEnabled) {
this.textFieldEnabled = textFieldEnabled;
- text.setEnabled(textFieldEnabled);
+ // IE has a non input disabled themeing that can not be overridden so we
+ // must fake the functionality using readonly and unselectable
+ if (BrowserInfo.get().isIE()) {
+ if (!textFieldEnabled) {
+ text.getElement().setAttribute("unselectable", "on");
+ text.getElement().setAttribute("readonly", "");
+ text.setTabIndex(-2);
+ } else if (textFieldEnabled
+ && text.getElement().hasAttribute("unselectable")) {
+ text.getElement().removeAttribute("unselectable");
+ text.getElement().removeAttribute("readonly");
+ text.setTabIndex(0);
+ }
+ } else {
+ text.setEnabled(textFieldEnabled);
+ }
+
if (textFieldEnabled) {
calendarToggle.setTabIndex(-1);
Roles.getButtonRole().setAriaHiddenState(
@@ -254,6 +270,20 @@ public class VPopupCalendar extends VTextualDate implements Field,
handleAriaAttributes();
}
+ /**
+ * Set correct tab index for disabled text field in IE as the value set in
+ * setTextFieldEnabled(...) gets overridden in
+ * TextualDateConnection.updateFromUIDL(...)
+ *
+ * @since
+ */
+ public void setTextFieldTabIndex() {
+ if (BrowserInfo.get().isIE() && !textFieldEnabled) {
+ // index needs to be -2 because FocusWidget updates -1 to 0 onAttach
+ text.setTabIndex(-2);
+ }
+ }
+
@Override
public void bindAriaCaption(
com.google.gwt.user.client.Element captionElement) {
@@ -426,10 +456,10 @@ public class VPopupCalendar extends VTextualDate implements Field,
public void onClose(CloseEvent<PopupPanel> event) {
if (event.getSource() == popup) {
buildDate();
- if (!BrowserInfo.get().isTouchDevice()) {
+ if (!BrowserInfo.get().isTouchDevice() && textFieldEnabled) {
/*
* Move focus to textbox, unless on touch device (avoids opening
- * virtual keyboard).
+ * virtual keyboard) or if textField is disabled.
*/
focus();
}
@@ -494,7 +524,7 @@ public class VPopupCalendar extends VTextualDate implements Field,
}
// superclass sets the text field independently when building date
- text.setEnabled(isEnabled() && isTextFieldEnabled());
+ setTextFieldEnabled(isEnabled() && isTextFieldEnabled());
}
/**
diff --git a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
index 6f059a7c16..7bcaaba04e 100644
--- a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
+++ b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
@@ -161,6 +161,8 @@ public class PopupDateFieldConnector extends TextualDateConnector {
getWidget().setDescriptionForAssistiveDevices(
getState().descriptionForAssistiveDevices);
+
+ getWidget().setTextFieldTabIndex();
}
@Override