public interface HasAriaLabel extends HasElement
The default implementations set the aria-label of the component to the given
HasElement.getElement()
. Override all methods in this interface if the
aria-label should be added to some other element.
The purpose of aria-label is to provide the user with a recognizable name of the component. If the label text is visible on screen, aria-label should not be used. There may be instances where the name of an element cannot be determined programmatically from the content of the element, and there are cases where providing a visible label is not the desired user experience. In the cases where a visible label or visible tooltip is undesirable, aria-label may be used to set the accessible name of the component.
See: https://www.w3.org/TR/wai-aria/#aria-label
Note: The aria-label property is not valid on every component, see https://www.w3.org/TR/using-aria/#label-support for more details.
Modifier and Type | Method and Description |
---|---|
default Optional<String> |
getAriaLabel()
Gets the aria-label of the component.
|
default void |
setAriaLabel(String ariaLabel)
Set the aria-label of the component to the given text.
|
getElement
default void setAriaLabel(String ariaLabel)
ariaLabel
- the aria-label text to set or null
to clearCopyright © 2024. All rights reserved.