Focus the first text input or submit button when showing a modal box.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8873 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-02-14 15:28:30 +00:00
parent a5037783d4
commit 0729ee143b
1 changed files with 5 additions and 4 deletions

View File

@ -314,9 +314,10 @@ 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();
}
}