From 3767bbec1829c13f33b6203aa0f7c9c6297cc33b Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Wed, 12 Sep 2018 17:18:24 +0200 Subject: [PATCH] Fixed: Donate button requiring two clicks to actually work. Fixes #2958 --- src/UI/Navbar/NavbarLayout.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/UI/Navbar/NavbarLayout.js b/src/UI/Navbar/NavbarLayout.js index e834531fc..36c4aef12 100644 --- a/src/UI/Navbar/NavbarLayout.js +++ b/src/UI/Navbar/NavbarLayout.js @@ -29,10 +29,17 @@ module.exports = Marionette.Layout.extend({ onClick : function(event) { var target = $(event.target); - + var linkElement = target; //look down for var href = event.target.getAttribute('href'); + if (!href && target.closest('a') && target.closest('a')[0]) { + + linkElement = target.closest('a')[0]; + + href = linkElement.getAttribute('href'); + } + if (href && href.startsWith("http")) { return; } @@ -40,15 +47,7 @@ module.exports = Marionette.Layout.extend({ event.preventDefault(); //if couldn't find it look up' - if (!href && target.closest('a') && target.closest('a')[0]) { - - var linkElement = target.closest('a')[0]; - - href = linkElement.getAttribute('href'); - this.setActive(linkElement); - } else { - this.setActive(event.target); - } + this.setActive(linkElement); if ($(window).width() < 768) { this.ui.collapse.collapse('hide');