diff options
author | michaelvogt <michael@vaadin.com> | 2013-05-07 15:33:43 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-05-17 10:42:26 +0000 |
commit | 2f6d5e0d8c7cf4912bb82207c0dbe26101d168cb (patch) | |
tree | c76690fc065077e8d04b01a486c81fa56bb249c0 /client | |
parent | 6c64757b35fa4f0f1100546f1a0bc44b71f87a85 (diff) | |
download | vaadin-framework-2f6d5e0d8c7cf4912bb82207c0dbe26101d168cb.tar.gz vaadin-framework-2f6d5e0d8c7cf4912bb82207c0dbe26101d168cb.zip |
Tooltip accessibility fixes (#11799)
Remove previously added attribute for WAI-ARIA live area
Set overlay container as live area instead
Change-Id: Ie75c2993fdb42f29f307cbd294ae3352d2ef1ce3
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ApplicationConnection.java | 26 | ||||
-rw-r--r-- | client/src/com/vaadin/client/VTooltip.java | 5 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/ui/UIConnector.java | 5 |
3 files changed, 32 insertions, 4 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index 1faf39394d..4141f9f2dc 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -27,6 +27,9 @@ import java.util.List; import java.util.Map; import java.util.Set; +import com.google.gwt.aria.client.LiveValue; +import com.google.gwt.aria.client.RelevantValue; +import com.google.gwt.aria.client.Roles; import com.google.gwt.core.client.Duration; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.JavaScriptObject; @@ -81,6 +84,7 @@ import com.vaadin.client.ui.AbstractConnector; import com.vaadin.client.ui.VContextMenu; import com.vaadin.client.ui.VNotification; import com.vaadin.client.ui.VNotification.HideEvent; +import com.vaadin.client.ui.VOverlay; import com.vaadin.client.ui.dd.VDragAndDropManager; import com.vaadin.client.ui.ui.UIConnector; import com.vaadin.client.ui.window.WindowConnector; @@ -456,6 +460,15 @@ public class ApplicationConnection { webkitMaybeIgnoringRequests = true; } }); + + // Ensure the overlay container is added to the dom and set as a live + // area for assistive devices + Element overlayContainer = VOverlay.getOverlayContainer(this); + Roles.getAlertRole().setAriaLiveProperty(overlayContainer, + LiveValue.ASSERTIVE); + setOverlayContainerLabel(getUIConnector().getState().overlayContainerLabel); + Roles.getAlertRole().setAriaRelevantProperty(overlayContainer, + RelevantValue.ADDITIONS); } /** @@ -3421,4 +3434,17 @@ public class ApplicationConnection { public void handlePushMessage(String message) { handleJSONText(message, 200); } + + /** + * Set the label of the container element, where tooltip, notification and + * dialgs are added to. + * + * @param overlayContainerLabel + * label for the container + */ + public void setOverlayContainerLabel(String overlayContainerLabel) { + Roles.getAlertRole().setAriaLabelProperty( + VOverlay.getOverlayContainer(this), + getUIConnector().getState().overlayContainerLabel); + } } diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java index 61d155d668..6191821988 100644 --- a/client/src/com/vaadin/client/VTooltip.java +++ b/client/src/com/vaadin/client/VTooltip.java @@ -16,7 +16,6 @@ package com.vaadin.client; import com.google.gwt.aria.client.Id; -import com.google.gwt.aria.client.LiveValue; import com.google.gwt.aria.client.Roles; import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.BlurHandler; @@ -86,10 +85,8 @@ public class VTooltip extends VOverlay { DOM.appendChild(layoutElement, description); setSinkShadowEvents(true); - // WAI-ARIA additions + // Used to bind the tooltip to the owner for assistive devices layoutElement.setId(uniqueId); - Roles.getTooltipRole().setAriaLiveProperty(getElement(), - LiveValue.POLITE); description.setId(DOM.createUniqueId()); Roles.getTooltipRole().set(layoutElement); diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java index 67cba1d3ea..643d687f1d 100644 --- a/client/src/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java @@ -629,6 +629,11 @@ public class UIConnector extends AbstractSingleComponentContainerConnector if (stateChangeEvent.hasPropertyChanged("pushMode")) { getConnection().setPushEnabled(getState().pushMode.isEnabled()); } + + if (stateChangeEvent.hasPropertyChanged("overlayContainerLabel")) { + getConnection().setOverlayContainerLabel( + getState().overlayContainerLabel); + } } private void configurePolling() { |