From: Go MAEDA Date: Wed, 28 Sep 2022 09:20:39 +0000 (+0000) Subject: Merged r21867 from trunk to 5.0-stable (#37473). X-Git-Tag: 5.0.3~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=534103f42db71debc38b55126c34e460340b8513;p=redmine.git Merged r21867 from trunk to 5.0-stable (#37473). git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@21868 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ef1cc2fc8..3bb8a602d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -334,7 +334,7 @@ module ApplicationHelper def toggle_link(name, id, options={}) onclick = +"$('##{id}').toggle(); " - onclick << (options[:focus] ? "$('##{options[:focus]}').focus(); " : "this.blur(); ") + onclick << (options[:focus] ? "$('##{options[:focus]}:visible').focus(); " : "this.blur(); ") onclick << "$(window).scrollTop($('##{options[:focus]}').position().top); " if options[:scroll] onclick << "return false;" link_to(name, "#", :onclick => onclick) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 91da19229..4d039cde1 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -958,7 +958,7 @@ function addFormObserversForDoubleSubmit() { function defaultFocus(){ if (($('#content :focus').length == 0) && (window.location.hash == '')) { - $('#content input[type=text], #content textarea').first().focus(); + $('#content input[type=text]:visible, #content textarea:visible').first().focus(); } }