From e2db3c69466c7ffa50684fa835c87670571af9f4 Mon Sep 17 00:00:00 2001 From: Jeroen Akkerman Date: Tue, 11 Jan 2022 20:10:00 +0100 Subject: [PATCH] Attempt at improving submenus in Safari for #362 --- src/js/easymde.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/js/easymde.js b/src/js/easymde.js index 3ee79e1..6435408 100644 --- a/src/js/easymde.js +++ b/src/js/easymde.js @@ -188,6 +188,11 @@ function removeClass(el, className) { function createToolbarDropdown(options, enableTooltips, shortcuts, parent) { var el = createToolbarButton(options, false, enableTooltips, shortcuts, 'button', parent); el.className += ' easymde-dropdown'; + + el.onclick = function () { + el.focus(); + }; + var content = document.createElement('div'); content.className = 'easymde-dropdown-content'; for (var childrenIndex = 0; childrenIndex < options.children.length; childrenIndex++) { @@ -201,6 +206,7 @@ function createToolbarDropdown(options, enableTooltips, shortcuts, parent) { childElement = createToolbarButton(child, true, enableTooltips, shortcuts, 'button', parent); } + childElement.addEventListener('click', function (e) { e.stopPropagation(); }, false); content.appendChild(childElement); } el.appendChild(content);