[TASK] Auto focus search field in content search 99/42999/4
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Thu, 3 Sep 2015 15:29:35 +0000 (17:29 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 3 Sep 2015 21:23:58 +0000 (23:23 +0200)
After enabling the content search (in Page / List module), the search field
is automatically focused.

Resolves: #69510
Releases: master
Change-Id: Ibba59db6ed0001c0fc1122b44651176a18a17e4b
Reviewed-on: http://review.typo3.org/42999
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Resources/Public/JavaScript/ToggleSearchToolbox.js

index 8e4f8ad..9756293 100644 (file)
 
 define('TYPO3/CMS/Backend/ToggleSearchToolbox', ['jquery'], function($) {
        $(document).ready(function() {
+               var $toolbar = $('#db_list-searchbox-toolbar');
                $('.t3js-toggle-search-toolbox').on('click', function() {
-                       $('#db_list-searchbox-toolbar').toggle();
+                       $toolbar.toggle();
+
+                       if ($toolbar.is(':visible')) {
+                               $('#search_field').focus();
+                       }
                });
        });
 });