From 3026a86b117a4c673efb095dd567af8543a74a2a Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 17 Aug 2021 09:21:57 -0700 Subject: [PATCH] Refines preventDefault logic --- bookwyrm/static/js/bookwyrm.js | 4 ++-- bookwyrm/templates/snippets/reading_modals/layout.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bookwyrm/static/js/bookwyrm.js b/bookwyrm/static/js/bookwyrm.js index 4d54b7232..db6be3f7f 100644 --- a/bookwyrm/static/js/bookwyrm.js +++ b/bookwyrm/static/js/bookwyrm.js @@ -138,10 +138,10 @@ let BookWyrm = new class { * @return {undefined} */ toggleAction(event) { - if (event.currentTarget == event.target) { + let trigger = event.currentTarget; + if (!trigger.dataset.allowDefault || event.currentTarget == event.target) { event.preventDefault(); } - let trigger = event.currentTarget; let pressed = trigger.getAttribute('aria-pressed') === 'false'; let targetId = trigger.dataset.controls; diff --git a/bookwyrm/templates/snippets/reading_modals/layout.html b/bookwyrm/templates/snippets/reading_modals/layout.html index 00e453350..0f5dedb0a 100644 --- a/bookwyrm/templates/snippets/reading_modals/layout.html +++ b/bookwyrm/templates/snippets/reading_modals/layout.html @@ -8,7 +8,7 @@ {% with 0|uuid as local_uuid %}
-