-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 OTP autofill in iOS Safari #21482
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
recheck |
@neil-marcellini look's like this one's your issue. Let me know if you need me to review and I'll reassign! |
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'll wait to review again until after @thesahindia approves, as per our new process, but here are some initial thoughts.
You say that we can't override the background color. Why not? The user agent stylesheet is simply the default style from the browser, as I understand it, so we should be able to set the backgroundColor here rather than using the transitionDelay hack.
Also, how can we test this in the dev environment?
@neil-marcellini you can test it by use your iPhone and receive sms from any number with format: |
I tried to override it but |
Quick bump for @thesahindia review. |
It seems like we can't change the backgroundColor but we have one another option. We can use opacity 0 instead of using
on mWeb if you are using the same wifi on your physical ios device and mac then you can open safari and navigate to I couldn't build the native app so will have to ask about in the channel I guess. @ginsuma, did you try building the app on physical device? Also you will need to attach the screenshots of all platforms you can just show the magic input page in other platforms so we know that the changes aren't breaking anything. |
App/src/components/MagicCodeInput.js Lines 299 to 302 in 09a7432
We cannot use opacity: 0 because the Paste option will not show. It happens on iOS/Chrome too.As I know, we don't expect to show the caret on magic code input.
I can't build on real iOS devices.I think we need permission to allow our apple developer account. |
Attached the videos of all platforms. |
@thesahindia I see on iOS/Chrome cannot show Paste option too because of |
Great explanation for why we can't override the background color @ginsuma, thank you. Now I'm happy with the background transition work around. Please explain that in a comment and link to the documentation.
Nice thanks! 👍 |
I not sure about it. I think I have used the paste option in chrome. I will try checking it on my physical device.
hmm, we should test it on physical device. Can you please post about it on the channel. |
@thesahindia I asked on Slack but no one can help or tried auto fill magic code from SMS on iOS app. App/src/components/MagicCodeInput.js Line 302 in 6170bec
App/src/components/MagicCodeInput.js Line 348 in 6170bec
|
@thesahindia I have successfully built app on my iPhone. Before and after my commit, the app does not auto fill code from SMS. It's same for Android. I think we don't support it yet. iOS Native Videoios.native.mov |
Quick bump for reviewing @thesahindia . |
Hey @ginsuma, on prod app, it does work for me on iOS. trim.A66577B0-57C4-4AB1-A145-39DE2DAFE7E2.MOV |
@Nikhil-Vats Thank you for your update. Can you tell me where you download prod app? |
From the App Store. |
@Nikhil-Vats I tried to search it but only the old version https://apps.apple.com/us/app/expensify-receipts-expenses/id471713959. Can you please give me the new version link? |
Cannot get auto fill from prod app on my iPhone. prod.app.mp4But my commits only applied for iOS Safari as I said above #21482 (comment). |
I changed the phone number and tried again with my build, the autofill works as normal. my.build.mp4 |
Cool thanks for testing again. It works on my device as well! I will complete the review today. |
@ginsuma, can you help with the instructions on building ios app on my physical device. I didn't find your post on slack. |
Do you have an Apple developer account? In |
Reviewer Checklist
Screenshots/VideosMobile Web - Safaritrim.9C3FB5E3-C66B-4229-B9FC-CB10DEDE2528.MOViOStrim.96FD63F3-B53E-4941-8CC8-DB7CAF17D2D4.MOV |
src/styles/styles.js
Outdated
@@ -2490,6 +2490,12 @@ const styles = { | |||
|
|||
magicCodeInputTransparent: { | |||
color: 'transparent', | |||
caretColor: 'transparent', | |||
WebkitTextFillColor: 'transparent', | |||
// The input text color get background-color after set it to transparent. |
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.
Let's use this comment -
"After setting the input text color to transparent, it acquires the background-color. However, it is not possible to override the background-color directly as explained in this resource: https://developer.mozilla.org/en-US/docs/Web/CSS/:autofill. Therefore, the transition effect needs to be delayed."
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 updated it. Thank you.
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.
It tested well, just suggested a comment change. I have a doctor's appointment today so approving the PR.
cc: @neil-marcellini
Friendly bump @neil-marcellini . |
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.
🚀
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 1.3.38-0 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.3.38-7 🚀
|
// After setting the input text color to transparent, it acquires the background-color. | ||
// However, it is not possible to override the background-color directly as explained in this resource: https://developer.mozilla.org/en-US/docs/Web/CSS/:autofill | ||
// Therefore, the transition effect needs to be delayed. | ||
transitionDelay: '99999s', |
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.
✋ Coming from #28340
We're calculating the height of the input based on onLayout
function, but when we navigate to the new page, the layout.height
will return 0. Ref: facebook/react-native#10743
After come back to 2FA page, the layout.height
is 52px, but we're using transitionDelay:99999s
for 2FA input here, that makes the input height is still 0
Details
Fixed Issues
$ #20642
PROPOSAL: #20642 (comment)
Tests
Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
mac_safari.mp4
Mobile Web - Safari
result.mp4
Mobile Web - Chrome
Screen.Recording.2023-06-28.at.4.55.55.PM.mov
Desktop
Screen.Recording.2023-06-28.at.5.09.32.PM.mov
iOS
my.build.mp4
Android
Screen.Recording.2023-06-28.at.5.04.04.PM.mov