diff options
-rw-r--r-- | client/src/com/vaadin/client/ui/AriaHelper.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/client/src/com/vaadin/client/ui/AriaHelper.java b/client/src/com/vaadin/client/ui/AriaHelper.java index e762ba57ce..f7b35add1d 100644 --- a/client/src/com/vaadin/client/ui/AriaHelper.java +++ b/client/src/com/vaadin/client/ui/AriaHelper.java @@ -24,16 +24,18 @@ public class AriaHelper { public static void bindCaption(Widget widget, Element captionElement) { assert widget != null : "Valid Widget required"; - ensureUniqueId(captionElement); + if (null != captionElement) { + ensureUniqueId(captionElement); - if (widget instanceof HandlesAriaCaption) { - ((HandlesAriaCaption) widget).handleAriaCaption(captionElement); - } else if (captionElement != null) { - String ownerId = ensureUniqueId(widget.getElement()); - captionElement.setAttribute("for", ownerId); + if (widget instanceof HandlesAriaCaption) { + ((HandlesAriaCaption) widget).handleAriaCaption(captionElement); + } else { + String ownerId = ensureUniqueId(widget.getElement()); + captionElement.setAttribute("for", ownerId); - Roles.getTextboxRole().setAriaLabelledbyProperty( - widget.getElement(), Id.of(captionElement)); + Roles.getTextboxRole().setAriaLabelledbyProperty( + widget.getElement(), Id.of(captionElement)); + } } else { Roles.getTextboxRole().removeAriaLabelledbyProperty( widget.getElement()); |