]> source.dussan.org Git - redmine.git/commitdiff
Focus the first text input or submit button when showing a modal box.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 14 Feb 2012 15:28:30 +0000 (15:28 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 14 Feb 2012 15:28:30 +0000 (15:28 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8873 e93f8b46-1217-0410-a6f0-8f06a7374b81

public/javascripts/application.js

index 2c4910c441e32e8021da81d94156721241ba1f3e..fdafc9899905b48e21f03cc394a87f5de068b84f 100644 (file)
@@ -314,10 +314,11 @@ function showModal(id, width) {
   el.addClassName('modal');
   el.show();
 
-  var submit = el.down("input[type=submit]");
-  if (submit) {
-    submit.focus();
-  }
+  if (el.down("input[type=text]")) {
+    el.down("input[type=text]").focus();
+  } else if (el.down("input[type=submit]")) {
+    el.down("input[type=submit]").focus();
+       } 
 }
 
 function hideModal(el) {