From: Alexander Ebert Date: Mon, 18 Apr 2016 08:43:09 +0000 (+0200) Subject: Re-Added autofocus support for dialogs X-Git-Tag: 3.0.0_Beta_1~1861 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b9c67a036b6374c02dbcf674f2377efb88e07658;p=GitHub%2FWoltLab%2FWCF.git Re-Added autofocus support for dialogs --- diff --git a/com.woltlab.wcf/templates/pageHeaderUser.tpl b/com.woltlab.wcf/templates/pageHeaderUser.tpl index 4ed650ff1b..612a6900a2 100644 --- a/com.woltlab.wcf/templates/pageHeaderUser.tpl +++ b/com.woltlab.wcf/templates/pageHeaderUser.tpl @@ -140,7 +140,7 @@
- +
diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dialog.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dialog.js index 4ae4a9e6d3..00adba2796 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dialog.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dialog.js @@ -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); }