handleAriaAttributes();
}
private void handleAriaAttributes() {
Widget removeFromWidget;
Widget setForWidget;
if (isTextFieldEnabled()) {
setForWidget = text;
removeFromWidget = calendarToggle;
} else {
setForWidget = calendarToggle;
removeFromWidget = text;
}
Roles.getFormRole().removeAriaLabelledbyProperty(
removeFromWidget.getElement());
if (captionId == null) {
Roles.getFormRole().removeAriaLabelledbyProperty(
setForWidget.getElement());
} else {
Roles.getFormRole().setAriaLabelledbyProperty(
setForWidget.getElement(), Id.of(captionId));
}
}