Skip to content

Firefly III: a personal finances manager

Fix the infernal issue with the too quick enter key.

James Cole57af6c76f512
diff --git a/resources/assets/v3/js/pages/transactions/create.js b/resources/assets/v3/js/pages/transactions/create.js
index a2fe33ebf4..19449febdc 100644
--- a/resources/assets/v3/js/pages/transactions/create.js
+++ b/resources/assets/v3/js/pages/transactions/create.js
@@ -342,6 +342,7 @@ let create = function () {
},
save() {
+
this.notifications.error.show = false;
this.notifications.success.show = false;
this.notifications.wait.show = true;
diff --git a/resources/assets/v3/js/pages/transactions/shared/keyup-from-category.js b/resources/assets/v3/js/pages/transactions/shared/keyup-from-category.js
index 9634cdc1f7..9fdbe5902b 100644
--- a/resources/assets/v3/js/pages/transactions/shared/keyup-from-category.js
+++ b/resources/assets/v3/js/pages/transactions/shared/keyup-from-category.js
@@ -20,11 +20,7 @@
export function keyUpFromCategory(e) {
let target = null === e.currentTarget ? null : e.currentTarget.nextSibling;
- setTimeout(() => {
- this.formStates.categorySelectVisible =
- null !== target && Object.hasOwn(target, "classList") && target.classList.contains("show");
- }, 600);
- if (e.key === "Enter" && false === this.formStates.categorySelectVisible) {
+ if ("Enter" === e.key && 'UL' === target.nodeName && !target.classList.contains("show")) {
this.save();
}
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/keyup-from-description.js b/resources/assets/v3/js/pages/transactions/shared/keyup-from-description.js
index d35dfc43f9..34f9db986b 100644
--- a/resources/assets/v3/js/pages/transactions/shared/keyup-from-description.js
+++ b/resources/assets/v3/js/pages/transactions/shared/keyup-from-description.js
@@ -18,13 +18,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+
export function keyUpFromDescription(e) {
let target = null === e.currentTarget ? null : e.currentTarget.nextSibling;
- setTimeout(() => {
- this.formStates.descriptionSelectVisible =
- null !== target && Object.hasOwn(target, "classList") && target.classList.contains("show");
- }, 600);
- if (e.key === "Enter" && false === this.formStates.descriptionSelectVisible) {
+ if ("Enter" === e.key && 'UL' === target.nodeName && !target.classList.contains("show")) {
this.save();
}
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/keyup-from-destination.js b/resources/assets/v3/js/pages/transactions/shared/keyup-from-destination.js
index 2476438c33..7aff78c639 100644
--- a/resources/assets/v3/js/pages/transactions/shared/keyup-from-destination.js
+++ b/resources/assets/v3/js/pages/transactions/shared/keyup-from-destination.js
@@ -20,11 +20,7 @@
export function keyUpFromDestination(e) {
let target = null === e.currentTarget ? null : e.currentTarget.nextSibling;
- setTimeout(() => {
- this.formStates.destinationSelectVisible =
- null !== target && Object.hasOwn(target, "classList") && target.classList.contains("show");
- }, 600);
- if (e.key === "Enter" && false === this.formStates.destinationSelectVisible) {
+ if ("Enter" === e.key && 'UL' === target.nodeName && !target.classList.contains("show")) {
this.save();
}
}
diff --git a/resources/assets/v3/js/pages/transactions/shared/keyup-from-source.js b/resources/assets/v3/js/pages/transactions/shared/keyup-from-source.js
index c23f2359a0..594f637716 100644
--- a/resources/assets/v3/js/pages/transactions/shared/keyup-from-source.js
+++ b/resources/assets/v3/js/pages/transactions/shared/keyup-from-source.js
@@ -20,11 +20,7 @@
export function keyUpFromSource(e) {
let target = null === e.currentTarget ? null : e.currentTarget.nextSibling;
- setTimeout(() => {
- this.formStates.sourceSelectVisible =
- null !== target && Object.hasOwn(target, "classList") && target.classList.contains("show");
- }, 600);
- if (e.key === "Enter" && false === this.formStates.sourceSelectVisible) {
+ if ("Enter" === e.key && 'UL' === target.nodeName && !target.classList.contains("show")) {
this.save();
}
}
diff --git a/resources/views/partials/form/transaction/category.blade.php b/resources/views/partials/form/transaction/category.blade.php
index c68b5e93e0..5d5c73458a 100644
--- a/resources/views/partials/form/transaction/category.blade.php
+++ b/resources/views/partials/form/transaction/category.blade.php
@@ -7,7 +7,7 @@
<input type="text"
class="form-control ac-category"
:id="'category_name_' + index"
- @keyup="keyUpFromCategory"
+ @keydown="keyUpFromCategory"
x-model="transaction.category_name"
:data-index="index"
placeholder="{{ __('firefly.category') }}">
diff --git a/resources/views/partials/form/transaction/description.blade.php b/resources/views/partials/form/transaction/description.blade.php
index 1cd050d70b..ae055536e9 100644
--- a/resources/views/partials/form/transaction/description.blade.php
+++ b/resources/views/partials/form/transaction/description.blade.php
@@ -7,7 +7,7 @@
<input type="search" class="form-control ac-description"
:id="'description_' + index"
@change="changedDescription"
- @keyup="keyUpFromDescription"
+ @keydown="keyUpFromDescription"
x-model="transaction.description"
:class="{'is-invalid': transaction.errors.description.length > 0, 'form-control': true}"
:data-index="index"
diff --git a/resources/views/partials/form/transaction/destination-account.blade.php b/resources/views/partials/form/transaction/destination-account.blade.php
index cc14e0e77d..6025a3bf37 100644
--- a/resources/views/partials/form/transaction/destination-account.blade.php
+++ b/resources/views/partials/form/transaction/destination-account.blade.php
@@ -18,7 +18,7 @@
:id="'dest_' + index"
x-model="transaction.destination_account.alpine_name"
:data-index="index"
- @keyup="keyUpFromDestination"
+ @keydown="keyUpFromDestination"
@changed="changedDestinationAccount"
x-bind:disabled="true===transaction.destination_account.disabled"
x-bind:readonly="true===transaction.destination_account.disabled"
diff --git a/resources/views/partials/form/transaction/source-account.blade.php b/resources/views/partials/form/transaction/source-account.blade.php
index 4171186158..3e6479da0c 100644
--- a/resources/views/partials/form/transaction/source-account.blade.php
+++ b/resources/views/partials/form/transaction/source-account.blade.php
@@ -18,7 +18,7 @@
:id="'source_' + index"
x-model="transaction.source_account.alpine_name"
:data-index="index"
- @keyup="keyUpFromSource"
+ @keydown="keyUpFromSource"
x-bind:disabled="true===transaction.source_account.disabled"
x-bind:readonly="true===transaction.source_account.disabled"
@changed="changedSourceAccount"