Interface HasAriaRole

All Superinterfaces:
HasElement, Serializable

public interface HasAriaRole extends HasElement
A generic interface for components and other user interface objects that may have a role DOM attribute to define the semantic meaning of the component for assistive technologies such as screen readers.

The default implementation sets the role of the component to the given HasElement.getElement(). Override the methods in this interface if the role should be added to some other element.

See: https://www.w3.org/TR/wai-aria/#usage_intro

Since:
25.3
Author:
Vaadin Ltd
  • Method Summary

    Modifier and Type
    Method
    Description
    default Optional<String>
    Gets the ARIA role attribute of the component.
    default void
    Sets the ARIA role attribute of the component to the given role.

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement
  • Method Details

    • setAriaRole

      default void setAriaRole(String role)
      Sets the ARIA role attribute of the component to the given role.
      Parameters:
      role - the role to set, or null to clear
    • getAriaRole

      default Optional<String> getAriaRole()
      Gets the ARIA role attribute of the component.
      Returns:
      an optional ARIA role of the component if no ARIA role has been set