diff options
author | michaelvogt <michael@vaadin.com> | 2013-06-19 16:15:23 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-07-03 11:18:57 +0000 |
commit | d2c2ebb61e64bec7aaec73aa4b75d1b8044cb021 (patch) | |
tree | 37c4ee24641ee4d2c6e29f0fa347cf9e7f1301dc | |
parent | d23c06a6145ca4c4f03377fc324e08693926873b (diff) | |
download | vaadin-framework-d2c2ebb61e64bec7aaec73aa4b75d1b8044cb021.tar.gz vaadin-framework-d2c2ebb61e64bec7aaec73aa4b75d1b8044cb021.zip |
Support screen reader only notifications (#11830)
Change-Id: I09391b27c0b3df538ffe74c4edb8d96224f14cd3
4 files changed, 31 insertions, 3 deletions
diff --git a/client/src/com/vaadin/client/ui/VNotification.java b/client/src/com/vaadin/client/ui/VNotification.java index 0ddc8bf7c5..128de0a285 100644 --- a/client/src/com/vaadin/client/ui/VNotification.java +++ b/client/src/com/vaadin/client/ui/VNotification.java @@ -52,6 +52,12 @@ public class VNotification extends VOverlay { public static final Position BOTTOM_LEFT = Position.BOTTOM_LEFT; public static final Position BOTTOM_RIGHT = Position.BOTTOM_RIGHT; + /** + * Position that is only accessible for assistive devices, invisible for + * visual users. + */ + public static final Position ASSISTIVE = Position.ASSISTIVE; + public static final int DELAY_FOREVER = -1; public static final int DELAY_NONE = 0; @@ -315,6 +321,10 @@ public class VNotification extends VOverlay { DOM.setStyleAttribute(el, "top", ""); DOM.setStyleAttribute(el, "bottom", "0px"); break; + case ASSISTIVE: + DOM.setStyleAttribute(el, "top", "-2000px"); + DOM.setStyleAttribute(el, "left", "-2000px"); + break; default: case MIDDLE_CENTER: center(); diff --git a/server/src/com/vaadin/ui/Notification.java b/server/src/com/vaadin/ui/Notification.java index f9bb1521e7..31fa265b02 100644 --- a/server/src/com/vaadin/ui/Notification.java +++ b/server/src/com/vaadin/ui/Notification.java @@ -64,7 +64,7 @@ import com.vaadin.shared.ui.ui.NotificationConfigurationBean.Role; */ public class Notification implements Serializable { public enum Type { - HUMANIZED_MESSAGE, WARNING_MESSAGE, ERROR_MESSAGE, TRAY_NOTIFICATION; + HUMANIZED_MESSAGE, WARNING_MESSAGE, ERROR_MESSAGE, TRAY_NOTIFICATION, ASSISTIVE_NOTIFICATION; } @Deprecated @@ -205,6 +205,12 @@ public class Notification implements Serializable { styleName = "tray"; setNavigationConfiguration("Info: ", "", Role.STATUS); break; + case ASSISTIVE_NOTIFICATION: + delayMsec = 3000; + position = Position.ASSISTIVE; + styleName = "assistive"; + setNavigationConfiguration("Note: ", "", Role.ALERT); + break; case HUMANIZED_MESSAGE: default: styleName = "humanized"; @@ -446,6 +452,10 @@ public class Notification implements Serializable { break; case TRAY_NOTIFICATION: style = "tray"; + break; + case ASSISTIVE_NOTIFICATION: + style = "assistive"; + break; case HUMANIZED_MESSAGE: default: style = "humanized"; @@ -548,4 +558,4 @@ public class Notification implements Serializable { public static void show(String caption, String description, Type type) { new Notification(caption, description, type).show(Page.getCurrent()); } -}
\ No newline at end of file +} diff --git a/shared/src/com/vaadin/shared/Position.java b/shared/src/com/vaadin/shared/Position.java index cd34ee8b87..3df42d65d8 100755 --- a/shared/src/com/vaadin/shared/Position.java +++ b/shared/src/com/vaadin/shared/Position.java @@ -16,5 +16,10 @@ package com.vaadin.shared; public enum Position { - TOP_LEFT, TOP_CENTER, TOP_RIGHT, MIDDLE_LEFT, MIDDLE_CENTER, MIDDLE_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT; + TOP_LEFT, TOP_CENTER, TOP_RIGHT, MIDDLE_LEFT, MIDDLE_CENTER, MIDDLE_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT, + /** + * Position that is only accessible for assistive devices, invisible for + * visual users. + **/ + ASSISTIVE; } diff --git a/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java b/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java index a8861d40de..27af49a397 100644 --- a/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java +++ b/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java @@ -63,6 +63,9 @@ public class NotificationsWaiAria extends TestBase { item = type.addItem(Notification.TYPE_TRAY_NOTIFICATION); item.getItemProperty(CAPTION).setValue("Tray"); + item = type.addItem(Notification.Type.ASSISTIVE_NOTIFICATION); + item.getItemProperty(CAPTION).setValue("Assistive"); + type.setValue(type.getItemIds().iterator().next()); addComponent(type); |