summaryrefslogtreecommitdiffstats
path: root/server/src
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 /server/src
parent5b9d0b9175f9ce2f20d728db844b6fd03fea1461 (diff)
downloadvaadin-framework-75b98bee62185c858a875393d50c3fa5e2fe64e7.tar.gz
vaadin-framework-75b98bee62185c858a875393d50c3fa5e2fe64e7.zip
Add ARIA label support to DateField (#10538)
Fixes #10454
Diffstat (limited to 'server/src')
-rw-r--r--server/src/main/java/com/vaadin/ui/AbstractDateField.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/server/src/main/java/com/vaadin/ui/AbstractDateField.java b/server/src/main/java/com/vaadin/ui/AbstractDateField.java
index 110223c628..3998afbae6 100644
--- a/server/src/main/java/com/vaadin/ui/AbstractDateField.java
+++ b/server/src/main/java/com/vaadin/ui/AbstractDateField.java
@@ -55,6 +55,7 @@ import com.vaadin.server.UserError;
import com.vaadin.shared.Registration;
import com.vaadin.shared.ui.datefield.AbstractDateFieldServerRpc;
import com.vaadin.shared.ui.datefield.AbstractDateFieldState;
+import com.vaadin.shared.ui.datefield.AbstractDateFieldState.AccessibleElement;
import com.vaadin.shared.ui.datefield.DateResolution;
import com.vaadin.ui.declarative.DesignAttributeHandler;
import com.vaadin.ui.declarative.DesignContext;
@@ -875,4 +876,31 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster &
}
return Collections.unmodifiableMap(hashMap);
}
+
+ /**
+ * Sets the assistive label for a calendar navigation element. This sets the
+ * {@code aria-label} attribute for the element which is used by screen
+ * reading software.
+ *
+ * @param element
+ * the element for which to set the label. Not {@code null}.
+ * @param label
+ * the assistive label to set
+ * @since
+ */
+ public void setAssistiveLabel(AccessibleElement element, String label) {
+ Objects.requireNonNull(element, "Element cannot be null");
+ getState().assistiveLabels.put(element, label);
+ }
+
+ /**
+ * Gets the assistive label of a calendar navigation element.
+ *
+ * @param element
+ * the element of which to get the assistive label
+ * @since
+ */
+ public void getAssistiveLabel(AccessibleElement element) {
+ getState(false).assistiveLabels.get(element);
+ }
}