Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: entering two zeros in a row in the 'Amount' field in wallet #19911

Merged
merged 1 commit into from
May 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/status_im/common/controlled_input/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@

(defn add-character
[state character]
(when (can-add-character? state character)
(if (can-add-character? state character)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this all to handle the custom keyboard?
We should really raise this with the design team as something to reconsider as it seems to be a bug factory that we could easily avoid :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also this looks good but since this is in /common/ I wonder is this code used elsewhere and if so is this the expected behaviour for these uses?

Copy link
Member Author

@OmarBasem OmarBasem May 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this all to handle the custom keyboard?

@J-Son89 Yes 🤷‍♂️

We should really raise this with the design team as something to reconsider as it seems to be a bug factory

Agreed! I think @vkjr worked on this, maybe he can share his thoughts also (and maybe @ulisesmac)

also this looks good but since this is in /common/

It is used in the send screen only.
The fix here is to return the same state if the character cannot be added. Previously was returning nil hence the crash.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah let's collate of all the lists and issues this brings in. I believe it's also a big takeaway from accessibility of the end user. @shivekkhurana was discussing something like this before.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey!
I just found this discussion since was on vacation.
Yes, if we continue to use custom keyboard, the controlled-input will be reused everywhere, this is the idea. But if in general we can reconsider using custom keyboard - I think it is even better)

(set-input-value state
(normalize-value-as-numeric (input-value state) character))))
(normalize-value-as-numeric (input-value state) character))
state))

(defn delete-last
[state]
Expand Down