-
Notifications
You must be signed in to change notification settings - Fork 208
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
[DO NO MERGE]: fix(number-field): separator interpreted as decimal #4552
[DO NO MERGE]: fix(number-field): separator interpreted as decimal #4552
Conversation
Tachometer resultsChromenumber-field permalinkbasic-test
slider permalinktest-basic
Firefoxnumber-field permalinkbasic-test
slider permalinktest-basic
|
Can you please add a test here! |
d7184b6
to
0d57c2c
Compare
0d57c2c
to
a04ef28
Compare
@@ -117,6 +117,40 @@ describe('NumberField', () => { | |||
expect(el.focusElement.value).to.equal('13 377 331'); | |||
}); | |||
}); | |||
xit('correctly interprets decimal point on iPhone', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a test with some common usecases but haven't been able to run it since I couldn't find a way to mock isIphone.
* chore(overlay): overlay-trigger adds receives focus attribute * chore(overlay): added storybook * chore(overlay): updated golden image cache --------- Co-authored-by: Rajdeep Chandra <rajdeepchandra@rajdeeps-mbp-2.macromedia.com> Co-authored-by: Rajdeep Chandra <rajdeepchandra@Rajdeeps-MacBook-Pro-2.local>
Co-authored-by: rmanole <rmanole@adobe.com>
This approach seems to fix the issue in most cases. That being said, I've found a corner case caused by the following flow:
Maybe there is a comparison to be made so that we can reset isIntentDecimal? We should also consider the position of said |
Some tests are failing. Can you have a look at them. Other than that LGTM! |
9703c43
to
0cab113
Compare
The merge-base changed after approval.
Looks like the Lighthouse CI check problem is similar with this one: #4269 (review) I think the performance check is also related given the fact that the storybook link is not generated correctly. |
@mizgaionutalexandru I can see you have polluted the commit history. I see 4 commits from main are being logged here! Can you please close this PR and create a fresh PR with these changes? |
Description
Updated the special
convertValueToNumber
case for iPhones to correctly identify user's intent of using a decimal point.Also changed the
,
or.
that's being replaced with the website language specific decimal character from the first occurrence left-to-right to right-to-left. (e.g. for 1,234,56 previously the value would've been 1.23456, now it is 1,234.56 to better reflect user's intent).Related issue(s)
Motivation and context
This solves the problem of a comma used as a separator in the number-field being interpreted as a decimal point when the user didn't want that. These changes came as a necessity since iOS keyboard shows either
,
or.
based on device's settings.How has this been tested?
Below you can find videos of some of these testings done on two different types of keyboard.
comma.keyboard.dot.website.mov
dot.keyboard.dot.website.mov
Types of changes
Checklist
Best practices
This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against
main
.