Improve UX of expenses

Enter on expense description will submit, and auto-complete suggestions will start from closer to longer matches.
This commit is contained in:
Bruno Bernardino
2025-03-26 15:55:04 +00:00
parent 5467fb3533
commit 1e1d3657a2
2 changed files with 12 additions and 1 deletions

View File

@@ -137,6 +137,17 @@ export default function ExpenseModal(
newExpenseDescription.value = event.currentTarget.value;
fetchSuggestions(event.currentTarget.value);
}}
onKeyDown={(event) => {
if (event.key === 'Enter') {
onClickSave(
formatInputToNumber(newExpenseCost.value),
newExpenseDescription.value,
newExpenseBudget.value,
newExpenseDate.value,
newExpenseIsRecurring.value,
);
}
}}
onFocus={() => {
if (suggestions.value.length > 0) {
showSuggestions.value = true;