85 lines
2.9 KiB
Diff
85 lines
2.9 KiB
Diff
From 5886765d8904de98db84b93d23b536fefd31373f Mon Sep 17 00:00:00 2001
|
|
From: novenary <novenary@kwak.zip>
|
|
Date: Tue, 17 Sep 2024 00:36:48 +0300
|
|
Subject: [PATCH] post_status_form: fix enter key in subject field
|
|
|
|
This fixes random actions being triggered by the enter key while the
|
|
subject field is focused.
|
|
|
|
When pressing enter, the browser simulates a click on the first "submit"
|
|
button it finds in the form.
|
|
A submit button is a button without `type="button"` set.
|
|
Remediate this by setting the type attribute on all but the "Post"
|
|
button.
|
|
|
|
Additionally, inhibit the enter key in the subject field (ctrl+enter
|
|
still works).
|
|
---
|
|
src/components/poll/poll_form.vue | 2 ++
|
|
src/components/post_status_form/post_status_form.vue | 5 +++++
|
|
2 files changed, 7 insertions(+)
|
|
|
|
diff --git a/src/components/poll/poll_form.vue b/src/components/poll/poll_form.vue
|
|
index 146754db..a67115b6 100644
|
|
--- a/src/components/poll/poll_form.vue
|
|
+++ b/src/components/poll/poll_form.vue
|
|
@@ -24,6 +24,7 @@
|
|
<button
|
|
v-if="options.length > 2"
|
|
class="delete-option button-unstyled -hover-highlight"
|
|
+ type="button"
|
|
@click="deleteOption(index)"
|
|
>
|
|
<FAIcon icon="times" />
|
|
@@ -32,6 +33,7 @@
|
|
<button
|
|
v-if="options.length < maxOptions"
|
|
class="add-option faint button-unstyled -hover-highlight"
|
|
+ type="button"
|
|
@click="addOption"
|
|
>
|
|
<FAIcon
|
|
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
|
|
index 79049f05..085a06a2 100644
|
|
--- a/src/components/post_status_form/post_status_form.vue
|
|
+++ b/src/components/post_status_form/post_status_form.vue
|
|
@@ -18,6 +18,7 @@
|
|
>
|
|
<button
|
|
class="button-unstyled -link"
|
|
+ type="button"
|
|
@click="openProfileTab"
|
|
>
|
|
{{ $t('post_status.account_not_locked_warning_link') }}
|
|
@@ -136,6 +137,7 @@
|
|
class="form-post-subject"
|
|
@input="onSubjectInput"
|
|
@focus="focusSubjectInput()"
|
|
+ @keydown.exact.enter.prevent
|
|
>
|
|
</EmojiInput>
|
|
<i18n-t
|
|
@@ -272,6 +274,7 @@
|
|
<button
|
|
class="emoji-icon button-unstyled"
|
|
:title="$t('emoji.add_emoji')"
|
|
+ type="button"
|
|
@click="showEmojiPicker"
|
|
>
|
|
<FAIcon icon="smile-beam" />
|
|
@@ -281,6 +284,7 @@
|
|
class="poll-icon button-unstyled"
|
|
:class="{ selected: pollFormVisible }"
|
|
:title="$t('polls.add_poll')"
|
|
+ type="button"
|
|
@click="togglePollForm"
|
|
>
|
|
<FAIcon icon="poll-h" />
|
|
@@ -290,6 +294,7 @@
|
|
class="spoiler-icon button-unstyled"
|
|
:class="{ selected: subjectVisible }"
|
|
:title="$t('post_status.toggle_content_warning')"
|
|
+ type="button"
|
|
@click="toggleSubjectVisible"
|
|
>
|
|
<FAIcon icon="eye-slash" />
|