Interface HasAriaDescription
- All Superinterfaces:
HasElement,Serializable
- All Known Implementing Classes:
AbstractNumberField,BigDecimalField,Checkbox,CheckboxGroup,ComboBox,ComboBoxBase,DatePicker,DecimalSlider,EmailField,IntegerField,IntegerSlider,MultiSelectComboBox,NumberField,PasswordField,RadioButtonGroup,Select,Switch,TextArea,TextField,TextFieldBase,TimePicker
The accessible description provides supplementary information about the
component to assistive technologies, such as screen readers. It is set by
referencing existing elements on the page with the aria-describedby
attribute.
- Since:
- 25.3
- Author:
- Vaadin Ltd
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionGets thearia-describedbyattribute of the component.default voidsetAriaDescribedBy(Component descriptionComponent) Sets thearia-describedbyattribute of the component to reference the given description component.default voidsetAriaDescribedBy(String ariaDescribedBy) Sets thearia-describedbyattribute of the component to one or more element IDs, separated by spaces.Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Method Details
-
setAriaDescribedBy
Sets thearia-describedbyattribute of the component to one or more element IDs, separated by spaces.Each ID must match the
idattribute of another element that describes the component. The description elements must be in the same DOM scope as the component, otherwise screen readers will fail to announce the description content properly.- Parameters:
ariaDescribedBy- a space-separated list of element IDs, ornullto remove the attribute- See Also:
-
setAriaDescribedBy
Sets thearia-describedbyattribute of the component to reference the given description component.The description component does not need an ID: if it has none by the time the value is sent to the client, one is generated automatically.
The description component must be in the same DOM scope as this component, otherwise screen readers will fail to announce the description content properly.
- Parameters:
descriptionComponent- the component to use as the description, notnull- Throws:
IllegalArgumentException- ifdescriptionComponentisnull; usesetAriaDescribedBy(String)withnullto remove the attribute instead- See Also:
-
getAriaDescribedBy
Gets thearia-describedbyattribute of the component.- Returns:
- an optional aria-describedby, or an empty optional if none has been set
-