Refines preventDefault logic

This commit is contained in:
Mouse Reeve 2021-08-17 09:21:57 -07:00
parent 2f93017eaa
commit 3026a86b11
2 changed files with 3 additions and 3 deletions

View file

@ -138,10 +138,10 @@ let BookWyrm = new class {
* @return {undefined} * @return {undefined}
*/ */
toggleAction(event) { toggleAction(event) {
if (event.currentTarget == event.target) { let trigger = event.currentTarget;
if (!trigger.dataset.allowDefault || event.currentTarget == event.target) {
event.preventDefault(); event.preventDefault();
} }
let trigger = event.currentTarget;
let pressed = trigger.getAttribute('aria-pressed') === 'false'; let pressed = trigger.getAttribute('aria-pressed') === 'false';
let targetId = trigger.dataset.controls; let targetId = trigger.dataset.controls;

View file

@ -8,7 +8,7 @@
{% with 0|uuid as local_uuid %} {% with 0|uuid as local_uuid %}
<div class="is-flex is-justify-content-space-between"> <div class="is-flex is-justify-content-space-between">
<label for="post_status_{{ local_uuid }}_{{ uuid }}" data-controls="reading_content_{{ local_uuid }}_{{ uuid }}" data-controls-checkbox="post_status_{{ local_uuid }}_{{ uuid }}" data-disables="reading_content_fieldset_{{ local_uuid }}_{{ uuid }}" aria-pressed="true"> <label for="post_status_{{ local_uuid }}_{{ uuid }}" data-controls="reading_content_{{ local_uuid }}_{{ uuid }}" data-controls-checkbox="post_status_{{ local_uuid }}_{{ uuid }}" data-disables="reading_content_fieldset_{{ local_uuid }}_{{ uuid }}" aria-pressed="true" data-allow-default="true">
<input type="checkbox" name="post-status" class="checkbox" id="post_status_{{ local_uuid }}_{{ uuid }}" checked> <input type="checkbox" name="post-status" class="checkbox" id="post_status_{{ local_uuid }}_{{ uuid }}" checked>
{% trans "Post to feed" %} {% trans "Post to feed" %}
</label> </label>