diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2017-03-14 11:47:05 -0500 |
---|---|---|
committer | Eric Eastwood <contact@ericeastwood.com> | 2017-03-14 11:53:22 -0500 |
commit | f97c1d1001a1c16ab51fb62723f30f6ffa467d4f (patch) | |
tree | 3e51a1d4a05180f766f0ab1c5648621a91e35665 /app/assets | |
parent | ffcddb295950729dbc4ee7a3c0e32f7dec00da99 (diff) | |
download | gitlab-ce-f97c1d1001a1c16ab51fb62723f30f6ffa467d4f.tar.gz |
Fix link togglers jumping to top29414-fix-toggle-disccusion-link-jump-pick-into-9-0
Fix #29414
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/behaviors/toggler_behavior.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/assets/javascripts/behaviors/toggler_behavior.js b/app/assets/javascripts/behaviors/toggler_behavior.js index 0726c6c9636..92f3bb3ff52 100644 --- a/app/assets/javascripts/behaviors/toggler_behavior.js +++ b/app/assets/javascripts/behaviors/toggler_behavior.js @@ -21,8 +21,13 @@ // %a.js-toggle-button // %div.js-toggle-content // - $('body').on('click', '.js-toggle-button', function() { + $('body').on('click', '.js-toggle-button', function(e) { toggleContainer($(this).closest('.js-toggle-container')); + + const targetTag = e.target.tagName.toLowerCase(); + if (targetTag === 'a' || targetTag === 'button') { + e.preventDefault(); + } }); // If we're accessing a permalink, ensure it is not inside a |