Bert Leunis pushed to branch master at cms-community / hippo-cms

Commits:
dc070262 by Mathijs den Burger at 2018-02-16T16:37:00+01:00
CMS-11080 Focus dialog content when opened

Use tabindex="-1" to make the div element of the content component
focusable.

- - - - -
9a9c9661 by Bert Leunis at 2018-02-19T10:28:32+01:00
CMS-11080 Merge master changes in bugfix/CMS-11080

- - - - -
fc386e82 by Bert Leunis at 2018-02-19T10:29:43+01:00
CMS-11080 Reintegrate bugfix/CMS-11080

- - - - -


1 changed file:

- api/src/main/java/org/hippoecm/frontend/dialog/DialogWindow.java


Changes:

=====================================
api/src/main/java/org/hippoecm/frontend/dialog/DialogWindow.java
=====================================
--- a/api/src/main/java/org/hippoecm/frontend/dialog/DialogWindow.java
+++ b/api/src/main/java/org/hippoecm/frontend/dialog/DialogWindow.java
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2008-2015 Hippo B.V. (http://www.onehippo.com)
+ *  Copyright 2008-2018 Hippo B.V. (http://www.onehippo.com)
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@ import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.wicket.AttributeModifier;
+import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 import org.apache.wicket.markup.head.IHeaderResponse;
@@ -218,9 +220,16 @@ public class DialogWindow extends ModalWindow implements 
IDialogService {
         AjaxRequestTarget target = 
RequestCycle.get().find(AjaxRequestTarget.class);
         if (target != null) {
             show(target);
+            focusContent(target);
         }
     }
 
+    private void focusContent(final AjaxRequestTarget target) {
+        final Component content = getContent();
+        content.add(new AttributeModifier("tabindex", -1)); // make content 
focusable
+        target.focusComponent(content);
+    }
+
     /**
      * Shows the modal window.
      *



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-cms/compare/71ebf0d414bf0179052bab11d24d1b86c106b10b...fc386e82e661e823eaec6d9ae1cb016ce5af6e3d

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-cms/compare/71ebf0d414bf0179052bab11d24d1b86c106b10b...fc386e82e661e823eaec6d9ae1cb016ce5af6e3d
You're receiving this email because of your account on code.onehippo.org.
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to