From ad290f8c65057bdef33ec73cb49a8c6d10b9e356 Mon Sep 17 00:00:00 2001 From: michaelvogt Date: Wed, 3 Apr 2013 14:12:42 +0300 Subject: Fix for CheckBox and Layout (#11407) Change in CheckBoxConnector led to wrong enabled behaviour and addition to top coordinate to prevent scrollbars with VPopupCalendar Change-Id: I381ab7c8a605535280ae58716181ef4c346997f7 --- WebContent/VAADIN/themes/base/common/common.scss | 1 + .../client/ui/checkbox/CheckBoxConnector.java | 4 +++- .../tests/layouts/CaptionsInLayoutsWaiAria.java | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/WebContent/VAADIN/themes/base/common/common.scss b/WebContent/VAADIN/themes/base/common/common.scss index 27c6dc949c..926bdc7b74 100644 --- a/WebContent/VAADIN/themes/base/common/common.scss +++ b/WebContent/VAADIN/themes/base/common/common.scss @@ -240,6 +240,7 @@ input::-ms-clear { .v-assistive-device-only { position: absolute; + top: -2000px; left: -2000px; width: 10px; overflow: hidden; diff --git a/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java b/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java index ebfda2d715..7c2052e6f1 100644 --- a/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java +++ b/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java @@ -92,7 +92,9 @@ public class CheckBoxConnector extends AbstractFieldConnector implements } getWidget().setRequired(isRequired()); - getWidget().setEnabled(!isReadOnly()); + if (isReadOnly()) { + getWidget().setEnabled(false); + } if (getIcon() != null) { if (getWidget().icon == null) { diff --git a/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java b/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java index 4ffe7f806e..ec323f2db2 100644 --- a/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java +++ b/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java @@ -55,6 +55,7 @@ public class CaptionsInLayoutsWaiAria extends TestBase { addComponent(toggleIcon()); addComponent(toggleReadOnly()); addComponent(toggleInvalid()); + addComponent(toggleEnabled()); addComponent(addCaptionText()); // layoutParent.addComponent(new // NativeButton("Button right of layout")); @@ -125,6 +126,21 @@ public class CaptionsInLayoutsWaiAria extends TestBase { return readOnlyToggle; } + private Component toggleEnabled() { + CheckBox enabledToggle = new CheckBox(); + enabledToggle.setImmediate(true); + enabledToggle.setValue(true); + enabledToggle.setCaption("Enabled"); + enabledToggle.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + setEnabled((Boolean) event.getProperty().getValue()); + } + }); + + return enabledToggle; + } + private Component toggleInvalid() { CheckBox invalid = new CheckBox("Invalid"); invalid.setImmediate(true); @@ -174,6 +190,12 @@ public class CaptionsInLayoutsWaiAria extends TestBase { } } + protected void setEnabled(boolean value) { + for (AbstractField c : components) { + c.setEnabled(value); + } + } + private Component toggleError() { CheckBox errorToggle = new CheckBox(); errorToggle.setImmediate(true); -- cgit v1.2.3