|
22 | 22 | import java.util.List; |
23 | 23 | import java.util.Locale; |
24 | 24 | import java.util.Objects; |
| 25 | +import java.util.Optional; |
25 | 26 | import java.util.stream.Collectors; |
26 | 27 | import java.util.stream.Stream; |
27 | 28 |
|
|
30 | 31 | import com.vaadin.flow.component.ComponentEvent; |
31 | 32 | import com.vaadin.flow.component.ComponentEventListener; |
32 | 33 | import com.vaadin.flow.component.Focusable; |
| 34 | +import com.vaadin.flow.component.HasAriaLabel; |
33 | 35 | import com.vaadin.flow.component.HasHelper; |
34 | 36 | import com.vaadin.flow.component.HasLabel; |
35 | 37 | import com.vaadin.flow.component.HasSize; |
|
89 | 91 | @NpmPackage(value = "date-fns", version = "2.29.3") |
90 | 92 | public class DatePicker |
91 | 93 | extends AbstractSinglePropertyField<DatePicker, LocalDate> |
92 | | - implements Focusable<DatePicker>, HasAllowedCharPattern, HasAutoOpen, |
93 | | - HasClearButton, HasClientValidation, HasHelper, HasLabel, |
| 94 | + implements Focusable<DatePicker>, HasAllowedCharPattern, HasAriaLabel, |
| 95 | + HasAutoOpen, HasClearButton, HasClientValidation, HasHelper, HasLabel, |
94 | 96 | HasOverlayClassName, HasPrefix, HasSize, HasStyle, HasTooltip, |
95 | 97 | HasThemeVariant<DatePickerVariant>, HasValidationProperties, |
96 | 98 | HasValidator<LocalDate> { |
@@ -366,6 +368,27 @@ public Locale getLocale() { |
366 | 368 | } |
367 | 369 | } |
368 | 370 |
|
| 371 | + @Override |
| 372 | + public void setAriaLabel(String ariaLabel) { |
| 373 | + getElement().setProperty("accessibleName", ariaLabel); |
| 374 | + } |
| 375 | + |
| 376 | + @Override |
| 377 | + public Optional<String> getAriaLabel() { |
| 378 | + return Optional.ofNullable(getElement().getProperty("accessibleName")); |
| 379 | + } |
| 380 | + |
| 381 | + @Override |
| 382 | + public void setAriaLabelledBy(String labelledBy) { |
| 383 | + getElement().setProperty("accessibleNameRef", labelledBy); |
| 384 | + } |
| 385 | + |
| 386 | + @Override |
| 387 | + public Optional<String> getAriaLabelledBy() { |
| 388 | + return Optional |
| 389 | + .ofNullable(getElement().getProperty("accessibleNameRef")); |
| 390 | + } |
| 391 | + |
369 | 392 | @Override |
370 | 393 | protected void onAttach(AttachEvent attachEvent) { |
371 | 394 | super.onAttach(attachEvent); |
|
0 commit comments