-
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 - mWeb/Safari- Chat - After tapping on "Copy to clipboard", options menu does not close #28820 #30085
Conversation
@cubuspl42 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@AmjedNazzal While Expensify doesn't have a strict policy on commit message content, and it's a known situation that many quickly typed commit messages land in the repo, I think this one is too much:
Please make it something like "Fix issue #28820" and force-push |
On Android/Chrome, are you able to paste the copied message successfully? |
@cubuspl42 Ops, apologies for that, I even noticed I hadn't made the title of the PR proper so I've edited that, now about chrome/android, thank you for bringing that up because I hadn't noticed but it seem like I can't paste copied messages but it's not related to this PR, I've tried with a new clone of the app that has nothing related to this PR and I can't paste the copied message in android/chrome even though the local app I'm testing on doesn't have my changes in it, interestingly it works on staging so I'm wondering if there is a recent PR that hasn't gone to staging yet that is causing this as a regression, I'm going to look into this |
I also noticed that this is not likely related to this PR. Still, as we're changing essentially the same functionality, we should ensure that it's working after our changes (unless we're in an extreme hurry, etc.). So I would say we should classify why the functionality is not fully working on Android/Chrome and hold on the relevant issue/PR. |
On physical iPhone 13 mini / iOS 17, though, I have the following problem both on RPReplay_Final1698066244-compressed.mp4The app blinks and the copying is not effective (the clipboard content is as it was before). |
@cubuspl42 I had a look around in all recent PRs and I couldn't find anything that has been merged but not deployed to staging yet that could be causing the android/chrome issue, I then checked why this is happening and what I managed to find out is that when running the app locally and browsing it from an android phone on chrome, it seem like whenever we try to call clipboard.write it throws an issue that it doesn't exist, I've done some logs and it seems like clipboard.write is not being exposed in navigation object at all, I'm suspecting this has to do with a permission issue as android phones connecting to.a locally run app will have a website not secure warning and maybe that's why it works on staging but not on local build, I don't have a way to absoloutely confirm that yet but I tried emulating a samsung phone on a cloud service and using a tunnel to access localhost and as you see in the video below it did work on that emulated-check.movWhen it comes to not being able to reproduce on iPhone 15, on my end without my changes I can reproduce the issue on iphone 15 as the video below shows issueOniPhone15.movWhen it comes to the physical iPhone 13 mini, unfortunately I don't have access to a physical iPhone, I tested on imulated 13 mini with iOS 17 and I couldn't see blinking, all I could see is that without my changes, the original issue happened and with my changes it behaved fine as I will show in two recordings, one with the original main and one after the change iphone13miniWithissue.moviphone13miniFixed.movYou said you get the blinking issue on your physical iPhone, do you get it in staging too or only on local builds? |
I found a stack discussion about the android chrome thing: https://stackoverflow.com/questions/51805395/navigator-clipboard-is-undefined Since when we try to access local build we use something like 192,168.1.100:8082 the browser will see it as not a secure origin since it's neither HTTPS nor localhost, hence why it worked when I tunneled into localhost using the emulator |
I had issues related to permissions & HTTP before, I'll try tunneling. |
I tried tunneling using ngrok with ngrok http --host-header=rewrite 8082 and it gave me a secure https connection to the local build so I tried it from my physical android phone and the paste now works fine, maybe that could resolve the iPhone mini issue as well |
I'm getting 429 during sign-in when I use |
@cubuspl42 what is your setup like? can you share some more information? What I do is configure authtoken with |
@cubuspl42 any updates? |
I'll try testing with the new HTTPS setup as recommended on Slack |
Reviewer Checklist
Screenshots/VideosWebfix-safari-copy-web.mp4Mobile Web - Chromefix-safari-copy-android-web-compressed.mp4Mobile Web - Safarifix-safari-copy-ios-web.mp4Desktopfix-safari-copy-desktop.mp4iOSfix-safari-copy-ios.mp4Androidfix-safari-copy-android-compressed.mp4 |
@tgolen Done! |
src/libs/Clipboard/index.js
Outdated
@@ -62,7 +62,8 @@ function setHTMLSync(html, text) { | |||
|
|||
if (isComposer) { | |||
firstAnchorChild.setSelectionRange(originalSelection.start, originalSelection.end, originalSelection.direction); | |||
} else { | |||
} else if (originalSelection.anchorNode && originalSelection.focusNode) { | |||
// We are adding a check for anchorNode and focusNode to prevent null values from being passed to setBaseAndExtent as per recent changes in Safari |
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.
If we are to add a comment, I think we should focus on:
- why these values can become
null
in practice - that
null
values are disallowed by this API per the standard
The fact that Safari actually started enforcing that is the least important matter and the comment might get outdated once other implementors start enforcing these null
-checks
I've added some further explanation |
@cubuspl42 is it better now? |
@AmjedNazzal Yes, thank you |
@tgolen Any more thoughts, or are we good to move forward? |
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.
Looks really good, thanks for that comment 👍
✋ 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/tgolen in version: 1.3.94-0 🚀
|
1 similar comment
🚀 Deployed to staging by https://github.com/tgolen in version: 1.3.94-0 🚀
|
🚀 Deployed to production by https://github.com/Beamanator in version: 1.3.94-2 🚀
|
🚀 Deployed to staging by https://github.com/tgolen in version: 1.3.95-0 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.95-9 🚀
|
Details
We are adding a check for anchorNode and focusNode not being null before using setBaseAndExtent since it no longer accepts null as per changes in WebKit source code
Fixed Issues
$ #28820
PROPOSAL: #28820 (comment)
Tests
Offline tests
Same as Tests
QA Steps
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
Android: Native
copytoclipboard-android-native.mp4
Android: mWeb Chrome
copytoclipboard-mweb-chrome.mp4
iOS: Native
copytoclipboard-ios-native.mov
iOS: mWeb Safari
copytoclipboard-mweb-safari17.mov
MacOS: Chrome / Safari
copytoclipboard-web-safari.mov
MacOS: Desktop
copytoclipboard-macos-desktop.mov