Project

General

Profile

Actions

Defect #39802

closed

Fix click event handling in mobile view after closing flyout menu

Added by salman mp 12 months ago. Updated 10 months ago.

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

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

In the mobile view, after opening flyout menu, there is a javascript that prevents click event on #main element. After closing menu it must reset to normal bahaviour, but despite mentioned in Patch #30448#note-13: Remove wrapper2 and wrapper3 wrapping containers this is not patched yet.

Index: public/javascripts/responsive.js
<+>UTF-8
===================================================================
diff --git a/public/javascripts/responsive.js b/public/javascripts/responsive.js
--- a/public/javascripts/responsive.js    (revision 41895:183d6d070b7e204d024b7f30fd0dac75ff60ef70)
+++ b/public/javascripts/responsive.js    (revision 41895+:183d6d070b7e+)
@@ -11,7 +11,7 @@

 function closeFlyout() {
   $('html').removeClass('flyout-is-active');
-  $('#wrapper').off('click');
+  $('#main').off('click');
 }


Files


Related issues

Related to Redmine - Patch #30448: Remove wrapper2 and wrapper3 wrapping containersClosedMarius BÄ‚LTEANU

Actions
Actions #1

Updated by salman mp 12 months ago

Better suggestion to prevent showing project select jump-box when flyout menu is showing.

Index: public/javascripts/responsive.js
===================================================================
diff --git a/public/javascripts/responsive.js b/public/javascripts/responsive.js
--- a/public/javascripts/responsive.js    (revision 41895:183d6d070b7e204d024b7f30fd0dac75ff60ef70)
+++ b/public/javascripts/responsive.js    (revision 41895+:183d6d070b7e+)
@@ -2,7 +2,7 @@

 function openFlyout() {
   $('html').addClass('flyout-is-active');
-  $('#main').on('click', function(e){
+  $('#main, #header').on('click', function(e){
     e.preventDefault();
     e.stopPropagation();
     closeFlyout();
@@ -11,7 +11,7 @@

 function closeFlyout() {
   $('html').removeClass('flyout-is-active');
-  $('#wrapper').off('click');
+  $('#main, #header').off('click');
 }
 
Actions #2

Updated by Mizuki ISHIKAWA 11 months ago

salman mp wrote:

In the mobile view, after opening flyout menu, there is a javascript that prevents click event on #main element. After closing menu it must reset to normal bahaviour, but despite mentioned in Patch #30448#note-13: Remove wrapper2 and wrapper3 wrapping containers this is not patched yet.

I've confirmed the issue you've pointed out. In the current code, as shown in the attached counting-of-click-event-function-calls.gif , the function added by openFlyout keeps accumulating.
Regarding #note-1, I agree it should be changed. When the flyout menu is open, opening the jump box doesn't fully display it and it doesn't function properly. Therefore, when clicking on #header, it's better to close the flyout menu rather than opening the jump box.

Actions #3

Updated by Mizuki ISHIKAWA 11 months ago

It is better to specify a namespace to avoid other event handlers being removed.
https://api.jquery.com/off/#:~:text=Unbind%20all%20delegated%20event%20handlers%20by%20their%20namespace

diff --git a/public/javascripts/responsive.js b/public/javascripts/responsive.js
index 9dc4db4e7..e5515dbac 100644
--- a/public/javascripts/responsive.js
+++ b/public/javascripts/responsive.js
@@ -19,7 +19,7 @@

 function openFlyout() {
   $('html').addClass('flyout-is-active');
-  $('#main').on('click', function(e){
+  $('#main, #header').on('click.close-flyout', function(e){
     e.preventDefault();
     e.stopPropagation();
     closeFlyout();
@@ -28,7 +28,7 @@ function openFlyout() {

 function closeFlyout() {
   $('html').removeClass('flyout-is-active');
-  $('#wrapper').off('click');
+  $('#main, #header').off('click.close-flyout');
 }

Actions #4

Updated by salman mp 11 months ago

Mizuki ISHIKAWA wrote in #note-3:

It is better to specify a namespace to avoid other event handlers being removed.
https://api.jquery.com/off/#:~:text=Unbind%20all%20delegated%20event%20handlers%20by%20their%20namespace
[...]

That's good. Thanks.

Actions #5

Updated by Go MAEDA 11 months ago

  • Related to Patch #30448: Remove wrapper2 and wrapper3 wrapping containers added
Actions #6

Updated by Go MAEDA 11 months ago

  • Target version set to 5.0.8

Setting the target version to 5.0.8.

Actions #7

Updated by Go MAEDA 10 months ago

  • Subject changed from Preventing click event on mobile view after flyout menu open and then closed to Fix click event handling in mobile view after closing flyout menu
  • Status changed from New to Resolved
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch in r22670.

Actions #8

Updated by Go MAEDA 10 months ago

  • Status changed from Resolved to Closed

Thank you for your contribution.

Actions

Also available in: Atom PDF