summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichaelvogt <michael@vaadin.com>2013-05-07 10:15:39 +0300
committermichaelvogt <michael@vaadin.com>2013-05-07 10:58:21 +0300
commit96b625003999cf341079a7db4e58016b1475456e (patch)
treea099634059e9b90e940810672499936bc26b379e
parent5388dce3783a05b9d2959cd5303bf13edcbf5d81 (diff)
downloadvaadin-framework-96b625003999cf341079a7db4e58016b1475456e.tar.gz
vaadin-framework-96b625003999cf341079a7db4e58016b1475456e.zip
Form field and layout Aria corrections (#11785)
Change-Id: I7625128dd02911230ffc50d5045a88489daa85b4
-rw-r--r--client/src/com/vaadin/client/VCaption.java20
-rw-r--r--client/src/com/vaadin/client/ui/VFilterSelect.java11
-rw-r--r--client/src/com/vaadin/client/ui/VPopupCalendar.java23
-rw-r--r--client/src/com/vaadin/client/ui/VTextField.java4
-rw-r--r--client/src/com/vaadin/client/ui/VTextualDate.java2
5 files changed, 47 insertions, 13 deletions
diff --git a/client/src/com/vaadin/client/VCaption.java b/client/src/com/vaadin/client/VCaption.java
index 591aeaa436..d033c2b4fe 100644
--- a/client/src/com/vaadin/client/VCaption.java
+++ b/client/src/com/vaadin/client/VCaption.java
@@ -90,8 +90,6 @@ public class VCaption extends HTML {
this.client = client;
owner = component;
- AriaHelper.bindCaption(component.getWidget(), getElement());
-
if (client != null && owner != null) {
setOwnerPid(getElement(), owner.getConnectorId());
}
@@ -99,6 +97,24 @@ public class VCaption extends HTML {
setStyleName(CLASSNAME);
}
+ @Override
+ protected void onAttach() {
+ super.onAttach();
+
+ if (null != owner) {
+ AriaHelper.bindCaption(owner.getWidget(), getElement());
+ }
+ }
+
+ @Override
+ protected void onDetach() {
+ super.onDetach();
+
+ if (null != owner) {
+ AriaHelper.bindCaption(owner.getWidget(), null);
+ }
+ }
+
/**
* Updates the caption from UIDL.
*
diff --git a/client/src/com/vaadin/client/ui/VFilterSelect.java b/client/src/com/vaadin/client/ui/VFilterSelect.java
index 3ad3d93abe..5ec7039462 100644
--- a/client/src/com/vaadin/client/ui/VFilterSelect.java
+++ b/client/src/com/vaadin/client/ui/VFilterSelect.java
@@ -68,6 +68,7 @@ import com.vaadin.client.UIDL;
import com.vaadin.client.Util;
import com.vaadin.client.VConsole;
import com.vaadin.client.ui.aria.AriaHelper;
+import com.vaadin.client.ui.aria.HandlesAriaCaption;
import com.vaadin.client.ui.aria.HandlesAriaInvalid;
import com.vaadin.client.ui.aria.HandlesAriaRequired;
import com.vaadin.client.ui.menubar.MenuBar;
@@ -85,7 +86,8 @@ import com.vaadin.shared.ui.combobox.FilteringMode;
@SuppressWarnings("deprecation")
public class VFilterSelect extends Composite implements Field, KeyDownHandler,
KeyUpHandler, ClickHandler, FocusHandler, BlurHandler, Focusable,
- SubPartAware, HandlesAriaInvalid, HandlesAriaRequired {
+ SubPartAware, HandlesAriaCaption, HandlesAriaInvalid,
+ HandlesAriaRequired {
/**
* Represents a suggestion in the suggestion popup box
@@ -1072,8 +1074,6 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
tb.addBlurHandler(this);
tb.addClickHandler(this);
- Roles.getTextboxRole().set(tb.getElement());
-
popupOpener.addClickHandler(this);
setStyleName(CLASSNAME);
@@ -1846,4 +1846,9 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
public void setAriaInvalid(boolean invalid) {
AriaHelper.handleInputInvalid(tb, invalid);
}
+
+ @Override
+ public void bindAriaCaption(Element captionElement) {
+ AriaHelper.bindCaption(tb, captionElement);
+ }
}
diff --git a/client/src/com/vaadin/client/ui/VPopupCalendar.java b/client/src/com/vaadin/client/ui/VPopupCalendar.java
index 410217a0dd..e431da127d 100644
--- a/client/src/com/vaadin/client/ui/VPopupCalendar.java
+++ b/client/src/com/vaadin/client/ui/VPopupCalendar.java
@@ -39,6 +39,7 @@ import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.PopupPanel.PositionCallback;
+import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.BrowserInfo;
import com.vaadin.client.VConsole;
@@ -102,10 +103,10 @@ public class VPopupCalendar extends VTextualDate implements Field,
descriptionForAssisitveDevicesElement
.setInnerText(PopupDateFieldState.DESCRIPTION_FOR_ASSISTIVE_DEVICES);
AriaHelper.ensureHasId(descriptionForAssisitveDevicesElement);
- Id.of(descriptionForAssisitveDevicesElement);
+ Roles.getTextboxRole().setAriaDescribedbyProperty(text.getElement(),
+ Id.of(descriptionForAssisitveDevicesElement));
AriaHelper.setVisibleForAssistiveDevicesOnly(
descriptionForAssisitveDevicesElement, true);
- DOM.appendChild(getElement(), descriptionForAssisitveDevicesElement);
calendar = GWT.create(VCalendarPanel.class);
calendar.setParentField(this);
@@ -118,6 +119,11 @@ public class VPopupCalendar extends VTextualDate implements Field,
}
});
+ // FIXME: Problem is, that the element with the provided id does not
+ // exist yet in html. This is the same problem as with the context menu.
+ // Apply here the same fix (#11795)
+ Roles.getTextboxRole().setAriaControlsProperty(text.getElement(),
+ Id.of(calendar.getElement()));
Roles.getButtonRole().setAriaControlsProperty(
calendarToggle.getElement(), Id.of(calendar.getElement()));
@@ -166,6 +172,19 @@ public class VPopupCalendar extends VTextualDate implements Field,
updateStyleNames();
}
+ @Override
+ protected void onAttach() {
+ super.onAttach();
+ DOM.appendChild(RootPanel.get().getElement(),
+ descriptionForAssisitveDevicesElement);
+ }
+
+ @Override
+ protected void onDetach() {
+ super.onDetach();
+ descriptionForAssisitveDevicesElement.removeFromParent();
+ }
+
@SuppressWarnings("deprecation")
public void updateValue(Date newDate) {
Date currentDate = getCurrentDate();
diff --git a/client/src/com/vaadin/client/ui/VTextField.java b/client/src/com/vaadin/client/ui/VTextField.java
index 60dc5a8f2a..da9445c811 100644
--- a/client/src/com/vaadin/client/ui/VTextField.java
+++ b/client/src/com/vaadin/client/ui/VTextField.java
@@ -16,7 +16,6 @@
package com.vaadin.client.ui;
-import com.google.gwt.aria.client.Roles;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.ChangeEvent;
@@ -96,9 +95,6 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler,
}
addFocusHandler(this);
addBlurHandler(this);
-
- // Add a11y role "textbox"
- Roles.getTextboxRole().set(node);
}
/**
diff --git a/client/src/com/vaadin/client/ui/VTextualDate.java b/client/src/com/vaadin/client/ui/VTextualDate.java
index cdfd8d00c2..9307455a83 100644
--- a/client/src/com/vaadin/client/ui/VTextualDate.java
+++ b/client/src/com/vaadin/client/ui/VTextualDate.java
@@ -103,8 +103,6 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
}
});
- Roles.getTextboxRole().set(text.getElement());
-
add(text);
}