From e6acf526385e8f56775790eb098feb331bc80f43 Mon Sep 17 00:00:00 2001 From: Sean Tsai <aleetsaiya@gmail.com> Date: Wed, 19 Jul 2023 02:23:10 +0800 Subject: [PATCH] Fix clicking enter will create empty transaction (#1316) fix #1301 After the change, upper components will not detect the press enter event before the datepicker is closed. --- .../desktop-client/src/components/select/DateSelect.js | 10 ++++------ upcoming-release-notes/1316.md | 6 ++++++ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 upcoming-release-notes/1316.md diff --git a/packages/desktop-client/src/components/select/DateSelect.js b/packages/desktop-client/src/components/select/DateSelect.js index e60af0a7a..2cd6ef0d6 100644 --- a/packages/desktop-client/src/components/select/DateSelect.js +++ b/packages/desktop-client/src/components/select/DateSelect.js @@ -263,12 +263,10 @@ export default function DateSelect({ let date = d.parse(selectedValue, dateFormat, new Date()); onSelect(d.format(date, 'yyyy-MM-dd')); - if (open) { - if (userSelectedValue.current !== selectedValue) { - // This stops the event from propagating up - e.stopPropagation(); - e.preventDefault(); - } + if (open && e.key === 'Enter') { + // This stops the event from propagating up + e.stopPropagation(); + e.preventDefault(); } let { onKeyDown } = inputProps || {}; diff --git a/upcoming-release-notes/1316.md b/upcoming-release-notes/1316.md new file mode 100644 index 000000000..bf3433165 --- /dev/null +++ b/upcoming-release-notes/1316.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [aleetsaiya] +--- + +Fix clicking enter will create empty transaction issue. -- GitLab