Project

General

Profile

Actions

Defect #37473

closed

Focus IssueId not working when linking issues

Added by Alexandre Guilleme almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Issues
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

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)

Actions #1

Updated by Go MAEDA almost 2 years 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.

Actions #2

Updated by Mizuki ISHIKAWA over 1 year 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();
   }
 }
Actions #3

Updated by Go MAEDA over 1 year ago

  • Target version set to Candidate for next minor release
Actions #4

Updated by Go MAEDA over 1 year ago

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

Setting the target version to 4.2.8.

Actions #5

Updated by Marius BĂLTEANU over 1 year ago

We updated jQuery to 3.6.1 on all stable versions and the fix proposed by Mizuki works in my environment. Is is something else that blocks us to commit the fix? I would like to include it in the new versions.

Actions #6

Updated by Marius BĂLTEANU over 1 year ago

  • Subject changed from Focus IssueId when linking issues to Focus IssueId not working when linking issues
Actions #7

Updated by Go MAEDA over 1 year ago

  • Status changed from Confirmed to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch. Thank you all for reporting and fixing the issue.

Marius BALTEANU wrote:

Is is something else that blocks us to commit the fix? I would like to include it in the new versions.

Sorry, I overlooked this issue.

Actions #8

Updated by Marius BĂLTEANU over 1 year ago

Go MAEDA wrote:

Committed the patch. Thank you all for reporting and fixing the issue.

Marius BALTEANU wrote:

Is is something else that blocks us to commit the fix? I would like to include it in the new versions.

Sorry, I overlooked this issue.

Thanks! Don't worry, I just wanted to double check that are not other issues with the patch.

Actions

Also available in: Atom PDF