diff options
author | Olli Tietäväinen <ollit@vaadin.com> | 2018-01-09 15:36:55 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2018-01-09 15:36:55 +0200 |
commit | 4a58876ee5bd0f599db343bf40ffef06c2e5eaba (patch) | |
tree | 2ef0af6b422d513384dbaa49481a4ea2199a132b /client | |
parent | 59a2dafdcb1333b278484bdd65b3ca3cc7bb87f8 (diff) | |
download | vaadin-framework-4a58876ee5bd0f599db343bf40ffef06c2e5eaba.tar.gz vaadin-framework-4a58876ee5bd0f599db343bf40ffef06c2e5eaba.zip |
Add aria-modal attribute and role='dialog' for modal Window (#10447)
Fixes #10424
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/VWindow.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VWindow.java b/client/src/main/java/com/vaadin/client/ui/VWindow.java index 02d3ce63cd..a07a08ef99 100644 --- a/client/src/main/java/com/vaadin/client/ui/VWindow.java +++ b/client/src/main/java/com/vaadin/client/ui/VWindow.java @@ -444,7 +444,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, && nativeEvent.getKeyCode() == KeyCodes.KEY_TAB && nativeEvent.getShiftKey()) { nativeEvent.preventDefault(); - FocusUtil.focusOnLastFocusableElement(this.getElement()); + FocusUtil.focusOnLastFocusableElement(getElement()); } if (nativeEvent.getEventTarget().cast() == topTabStop && nativeEvent.getKeyCode() == KeyCodes.KEY_BACKSPACE) { @@ -461,7 +461,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, && nativeEvent.getKeyCode() == KeyCodes.KEY_TAB && !nativeEvent.getShiftKey()) { nativeEvent.preventDefault(); - FocusUtil.focusOnFirstFocusableElement(this.getElement()); + FocusUtil.focusOnFirstFocusableElement(getElement()); } if (nativeEvent.getEventTarget().cast() == bottomTabStop && nativeEvent.getKeyCode() == KeyCodes.KEY_BACKSPACE) { @@ -706,12 +706,16 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, public void setVaadinModality(boolean modality) { vaadinModality = modality; if (vaadinModality) { + getElement().setAttribute("aria-modal", "true"); + Roles.getDialogRole().set(getElement()); if (isAttached()) { showModalityCurtain(); } addTabBlockHandlers(); deferOrdering(); } else { + getElement().removeAttribute("aria-modal"); + Roles.getDialogRole().remove(getElement()); if (modalityCurtain != null) { if (isAttached()) { hideModalityCurtain(); |