Package com.vaadin.client.ui.aria
Class AriaHelper
- java.lang.Object
-
- com.vaadin.client.ui.aria.AriaHelper
-
public class AriaHelper extends Object
Helper class that helps to implement the WAI-ARIA functionality.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ASSISTIVE_DEVICE_ONLY_STYLE
-
Constructor Summary
Constructors Constructor Description AriaHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
bindCaption(com.google.gwt.user.client.ui.Widget widget, com.google.gwt.dom.client.Element captionElement)
Binds a caption (label in HTML speak) to the form element as required by WAI-ARIA specification.static String
ensureHasId(com.google.gwt.dom.client.Element element)
Makes sure that the provided element has an id attribute.static void
handleInputInvalid(com.google.gwt.dom.client.Element element, boolean invalid)
Handles the required actions depending of the input element contains unaccepted input.static void
handleInputInvalid(com.google.gwt.user.client.ui.Widget widget, boolean invalid)
Handles the required actions depending of the input Widget contains unaccepted input.static void
handleInputRequired(com.google.gwt.dom.client.Element element, boolean required)
Handles the required actions depending of the input element being required or not.static void
handleInputRequired(com.google.gwt.user.client.ui.Widget widget, boolean required)
Handles the required actions depending of the input Widget being required or not.static void
setVisibleForAssistiveDevicesOnly(com.google.gwt.dom.client.Element element, boolean assistiveOnly)
Allows to move an element out of the visible area of the browser window.
-
-
-
Field Detail
-
ASSISTIVE_DEVICE_ONLY_STYLE
public static final String ASSISTIVE_DEVICE_ONLY_STYLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
bindCaption
public static void bindCaption(com.google.gwt.user.client.ui.Widget widget, com.google.gwt.dom.client.Element captionElement)
Binds a caption (label in HTML speak) to the form element as required by WAI-ARIA specification.- Parameters:
widget
- Widget, that should be bound to the captioncaptionElements
- Element with of caption to bind
-
handleInputRequired
public static void handleInputRequired(com.google.gwt.user.client.ui.Widget widget, boolean required)
Handles the required actions depending of the input Widget being required or not.- Parameters:
widget
- Widget, typically an input Widget like TextFieldrequired
- boolean, true when the element is required
-
handleInputRequired
public static void handleInputRequired(com.google.gwt.dom.client.Element element, boolean required)
Handles the required actions depending of the input element being required or not.- Parameters:
element
- Element, typically from an input Widget like TextFieldrequired
- boolean, true when the element is required
-
handleInputInvalid
public static void handleInputInvalid(com.google.gwt.user.client.ui.Widget widget, boolean invalid)
Handles the required actions depending of the input Widget contains unaccepted input.- Parameters:
widget
- Widget, typically an input Widget like TextFieldinvalid
- boolean, true when the Widget input has an error
-
handleInputInvalid
public static void handleInputInvalid(com.google.gwt.dom.client.Element element, boolean invalid)
Handles the required actions depending of the input element contains unaccepted input.- Parameters:
element
- Element, typically an input Widget like TextFieldinvalid
- boolean, true when the element input has an error
-
ensureHasId
public static String ensureHasId(com.google.gwt.dom.client.Element element)
Makes sure that the provided element has an id attribute. Adds a new unique id if not.- Parameters:
element
- Element to check- Returns:
- String with the id of the element
-
setVisibleForAssistiveDevicesOnly
public static void setVisibleForAssistiveDevicesOnly(com.google.gwt.dom.client.Element element, boolean assistiveOnly)
Allows to move an element out of the visible area of the browser window. This makes it possible to have additional information for an assistive device, that is not in the way for visual users.- Parameters:
element
- Element to move out of sightboolean
- assistiveOnly true when element should only be visible for assistive devices, false to make the element visible for all
-
-