summaryrefslogtreecommitdiffstats
path: root/shared
diff options
context:
space:
mode:
authorAdam Wagner <wbadam@users.noreply.github.com>2018-01-31 11:26:59 +0200
committerIlia Motornyi <elmot@vaadin.com>2018-01-31 11:26:59 +0200
commit75b98bee62185c858a875393d50c3fa5e2fe64e7 (patch)
tree7bc8f3ab6360bf4c1f6758c49faddee0ea9900fb /shared
parent5b9d0b9175f9ce2f20d728db844b6fd03fea1461 (diff)
downloadvaadin-framework-75b98bee62185c858a875393d50c3fa5e2fe64e7.tar.gz
vaadin-framework-75b98bee62185c858a875393d50c3fa5e2fe64e7.zip
Add ARIA label support to DateField (#10538)
Fixes #10454
Diffstat (limited to 'shared')
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/datefield/AbstractDateFieldState.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/shared/src/main/java/com/vaadin/shared/ui/datefield/AbstractDateFieldState.java b/shared/src/main/java/com/vaadin/shared/ui/datefield/AbstractDateFieldState.java
index 69bc065cff..553e82a57e 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/datefield/AbstractDateFieldState.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/datefield/AbstractDateFieldState.java
@@ -31,6 +31,18 @@ import com.vaadin.shared.annotations.NoLayout;
*/
public class AbstractDateFieldState extends AbstractFieldState {
+ /**
+ * Navigation elements that have assistive label.
+ *
+ * @since
+ */
+ public enum AccessibleElement {
+ PREVIOUS_YEAR,
+ NEXT_YEAR,
+ PREVIOUS_MONTH,
+ NEXT_MONTH
+ }
+
{
primaryStyleName = "v-datefield";
}
@@ -114,4 +126,19 @@ public class AbstractDateFieldState extends AbstractFieldState {
*/
public Map<String, String> dateStyles = new HashMap<String, String>();
+ /**
+ * Map of elements and their corresponding assistive labels.
+ *
+ * @since
+ */
+ public Map<AccessibleElement, String> assistiveLabels = new HashMap<>();
+
+ // Set default accessive labels
+ {
+ assistiveLabels.put(AccessibleElement.PREVIOUS_YEAR, "Previous year");
+ assistiveLabels.put(AccessibleElement.NEXT_YEAR, "Next year");
+ assistiveLabels.put(AccessibleElement.PREVIOUS_MONTH, "Previous month");
+ assistiveLabels.put(AccessibleElement.NEXT_MONTH, "Next month");
+ }
+
}