summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichaelvogt <michael@vaadin.com>2013-09-05 10:10:37 +0200
committerVaadin Code Review <review@vaadin.com>2013-09-10 08:27:46 +0000
commitba76f5660bc74fc7a96b93944a79f95366c53b8d (patch)
treef982450bda4fbe7b9e2273b2b6ed4d573f732ce4
parent8f63873fde0399d47e7dce8156485f03526f3a60 (diff)
downloadvaadin-framework-ba76f5660bc74fc7a96b93944a79f95366c53b8d.tar.gz
vaadin-framework-ba76f5660bc74fc7a96b93944a79f95366c53b8d.zip
Prevent exception in VWindow without assistive description (#12515)
Change-Id: Id16584ac2aec95981de31d713b56de42ca0cfae2
-rw-r--r--client/src/com/vaadin/client/ui/VWindow.java30
1 files changed, 19 insertions, 11 deletions
diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java
index 18df2222a4..03ad8d03c8 100644
--- a/client/src/com/vaadin/client/ui/VWindow.java
+++ b/client/src/com/vaadin/client/ui/VWindow.java
@@ -1323,6 +1323,8 @@ public class VWindow extends VWindowOverlay implements
* Allows to specify which connectors contain the description for the
* window. Text contained in the widgets of the connectors will be read by
* assistive devices when it is opened.
+ * <p>
+ * When the provided array is empty, an existing description is removed.
*
* @param connectors
* with the connectors of the widgets to use as description
@@ -1331,20 +1333,26 @@ public class VWindow extends VWindowOverlay implements
if (connectors != null) {
assistiveConnectors = connectors;
- Id[] ids = new Id[connectors.length];
- for (int index = 0; index < connectors.length; index++) {
- if (connectors[index] == null) {
- throw new IllegalArgumentException(
- "All values in parameter description need to be non-null");
+ if (connectors.length == 0) {
+ Roles.getDialogRole().removeAriaDescribedbyProperty(
+ getElement());
+ } else {
+ Id[] ids = new Id[connectors.length];
+ for (int index = 0; index < connectors.length; index++) {
+ if (connectors[index] == null) {
+ throw new IllegalArgumentException(
+ "All values in parameter description need to be non-null");
+ }
+
+ Element element = ((ComponentConnector) connectors[index])
+ .getWidget().getElement();
+ AriaHelper.ensureHasId(element);
+ ids[index] = Id.of(element);
}
- Element element = ((ComponentConnector) connectors[index])
- .getWidget().getElement();
- AriaHelper.ensureHasId(element);
- ids[index] = Id.of(element);
+ Roles.getDialogRole().setAriaDescribedbyProperty(getElement(),
+ ids);
}
-
- Roles.getDialogRole().setAriaDescribedbyProperty(getElement(), ids);
} else {
throw new IllegalArgumentException(
"Parameter description must be non-null");