[Rt-commit] rt branch 5.0/protect-links-and-buttons-in-inline-edit-click-panels created. rt-5.0.2-25-gbf18419aa4

BPS Git Server git at git.bestpractical.com
Thu Oct 7 19:47:42 UTC 2021


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/protect-links-and-buttons-in-inline-edit-click-panels has been created
        at  bf18419aa44a155b6eff167cbf6bdf77a5c9939f (commit)

- Log -----------------------------------------------------------------
commit bf18419aa44a155b6eff167cbf6bdf77a5c9939f
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Oct 8 03:17:50 2021 +0800

    Don't trigger inline edit if user clicks links, buttons or their children
    
    This is for inline edit panels with "click" behavior. Previously only
    plain links were protected. E.g. the "New Incident" link on RTIR
    Incident Report page wasn't protected because the click event target is
    the icon(svg) child of the link instead of the link itself.
    
    All buttons were not protected either. Note that there is a special case
    of button: selects with selectpicker are also rendered in buttons.
    
    This commit protects both links and buttons.

diff --git a/share/static/js/util.js b/share/static/js/util.js
index 5c0c7fc18f..7183d91d87 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -1047,12 +1047,12 @@ jQuery(function () {
     });
 
     jQuery('.titlebox[data-inline-edit-behavior="click"] > .titlebox-content').click(function (e) {
-        if (jQuery(e.target).is('a, input, select, textarea')) {
+        if (jQuery(e.target).is('input, select, textarea')) {
             return;
         }
 
-        // Bypass radio/checkbox controls too
-        if (jQuery(e.target).closest('div.custom-radio, div.custom-checkbox').length) {
+        // Bypass links, buttons and radio/checkbox controls too
+        if (jQuery(e.target).closest('a, button, div.custom-radio, div.custom-checkbox').length) {
             return;
         }
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list