From dcddfcdc57a694cb97dae9b2548925642e2224f8 Mon Sep 17 00:00:00 2001 From: Alex Gibson Date: Fri, 5 Oct 2018 09:23:50 +0100 Subject: [PATCH] Fixed menu component focusout bug (Fixes #247) --- CHANGELOG.md | 4 ++++ src/assets/js/protocol/protocol-menu.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca1ed1d4..398b9ebd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ * **docs:** Document deployment process (#171) +## Bug Fixes + +* **js:** Fixed menu component focusout bug (#247) + # 2.4.2 * **css:** Add blockquote component (#234) diff --git a/src/assets/js/protocol/protocol-menu.js b/src/assets/js/protocol/protocol-menu.js index 6ba3b7be..aac34be8 100644 --- a/src/assets/js/protocol/protocol-menu.js +++ b/src/assets/js/protocol/protocol-menu.js @@ -155,7 +155,8 @@ if (typeof Mozilla === 'undefined') { * re-queues the JavaScript to run at the end of the current excecution. */ setTimeout(function() { - if (!self.contains(document.activeElement)) { + // If the menu is open and the newly focused element is not a child, then call close(). + if (!self.contains(document.activeElement) && self.classList.contains('is-selected')) { Menu.close(); } }, 0);