[TASK] Improve UX of Add media by url modal 46/44046/3
authorFrans Saris <franssaris@gmail.com>
Wed, 14 Oct 2015 09:24:34 +0000 (11:24 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Wed, 14 Oct 2015 09:30:56 +0000 (11:30 +0200)
When pressing ENTER in the input field, the button to process the field
is triggerd now. The OK button of the error modal is now focussed by
default.

Resolves: #70680
Releases: master
Change-Id: Ib056c5754a591e9b8b19b94cb338e75218a8bdca
Reviewed-on: http://review.typo3.org/44046
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/backend/Resources/Public/JavaScript/OnlineMedia.js

index 85d2ad6..efaf72b 100644 (file)
@@ -56,7 +56,8 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Lang/Lang']
                                                        [{
                                                                text: TYPO3.lang['button.ok'] || 'OK',
                                                                btnClass: 'btn-' + Modal.getSeverityClass(top.TYPO3.Severity.error),
-                                                               name: 'ok'
+                                                               name: 'ok',
+                                                               active: true
                                                        }]
                                                ).on('confirm.button.ok', function() {
                                                        $confirm.modal('hide');
@@ -91,9 +92,13 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Lang/Lang']
                                }]
                        );
 
-                       $modal.on('shown.bs.modal', function(e) {
+                       $modal.on('shown.bs.modal', function() {
                                // focus the input field
-                               $(this).find('input.online-media-url').first().focus();
+                               $(this).find('input.online-media-url').first().focus().on('keydown', function(e) {
+                                       if (e.keyCode === 13) {
+                                               $modal.find('button[name="ok"]').trigger('click');
+                                       }
+                               });
                        });
                });
        };