Re-Added autofocus support for dialogs
authorAlexander Ebert <ebert@woltlab.com>
Mon, 18 Apr 2016 08:43:09 +0000 (10:43 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 18 Apr 2016 08:43:09 +0000 (10:43 +0200)
com.woltlab.wcf/templates/pageHeaderUser.tpl
wcfsetup/install/files/js/WoltLab/WCF/Ui/Dialog.js

index 4ed650ff1b76d0129a31b68e14f1b9fc10c1f7ff..612a6900a219aff07f85a572cc1e3d119d2385f9 100644 (file)
                                                                <dl>
                                                                        <dt><label for="username">{lang}wcf.user.usernameOrEmail{/lang}</label></dt>
                                                                        <dd>
-                                                                               <input type="text" id="username" name="username" value="" required="required" class="long">
+                                                                               <input type="text" id="username" name="username" value="" required="required" class="long jsDialogAutoFocus">
                                                                        </dd>
                                                                </dl>
                                                                
index 4ae4a9e6d3a77dea5b722eca0743a4c10a82a7c2..00adba27969e958bf934a51eaaf088a5e04b1dc3 100644 (file)
@@ -389,6 +389,12 @@ define(
                                
                                this.rebuild(id);
                                
+                               // set focus on first applicable element
+                               var focusElement = elBySel('.jsDialogAutoFocus', data.dialog);
+                               if (focusElement !== null && focusElement.offsetParent !== null) {
+                                       focusElement.focus();
+                               }
+                               
                                if (typeof data.onShow === 'function') {
                                        data.onShow(id);
                                }