Defect #37473

Focus IssueId when linking issues

Added by Alexandre Guilleme 27 days ago. Updated 19 days ago.

Status:ConfirmedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues
Target version:4.2.8
Resolution: Affected version:4.2.7

Description

When I click on the add link in the linked issues section of an issue, the kind Combo and the IssueNumber edit are displayed. Before (can't remember if 5.0.0 or 4.X), the Edit received focus, so that I could just type in issue number directly after clicking Add. Now, I must manually clic in the Edit before typing.

(the captions may be wrong as I am in french translation)

History

#1 Updated by Go MAEDA 27 days ago

  • Status changed from New to Confirmed
  • Affected version changed from 5.0.2 to 4.2.7

Alexandre Guilleme wrote:

Before (can't remember if 5.0.0 or 4.X), the Edit received focus, so that I could just type in issue number directly after clicking Add. Now, I must manually clic in the Edit before typing.

I have confirmed the issue. Redmine 4.1.7 works as described but Redmine 4.2.7 and 5.0.2 don't.

#2 Updated by Mizuki ISHIKAWA 22 days ago

I think this is a jQuery 3.6.0 specific issue and is related to the following two issues.

Even with jQuery 3.6.0, the problem does not seem to occur if the code is changed to focus only when the focus target is :visible, as in the following diff.

diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e2eebfa412..95975cdd78 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -335,7 +335,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 91da192290..4d039cde12 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();
   }
 }

#3 Updated by Go MAEDA 21 days ago

  • Target version set to Candidate for next minor release

#4 Updated by Go MAEDA 19 days ago

  • Target version changed from Candidate for next minor release to 4.2.8

Setting the target version to 4.2.8.

Also available in: Atom PDF