-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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/Web Safari - Selecting attachment #2229
Fix: mWeb/Web Safari - Selecting attachment #2229
Conversation
Sometimes the selected item need to be used to trigger an action before the popup closes. Calling `props.onItemSelected` with the pressed item serves for that purpose while existing workflows are unaffected
Safari, mobile Safari and mobile Chrome, do not show the attachment picker because the button that is pressed disappears right away because it's inside the CreateMenu popup Keeping the button that will be triggered when `openPicker` is called mounted By not closing the CreateMenu ahead of time
It might be better to wait for #2114 to be merged as it also made changes to the Attachment Picker |
OK, looks like that other PR would be good to merge first. Would you mind adding |
Other PR is now merged, removing the hold. |
…chment-fix Conflicts: src/pages/home/report/ReportActionCompose.js
Updated |
Hey sorry I've just noticed but I need to also update the usage of the Attachment Picker on the ProfilePage: const menuItems = [
{
icon: Upload,
text: 'Upload Photo',
onSelected: () => {
setTimeout(() => {
openPicker({
onPicked: setAvatar,
});
}, 10);
},
},
]; I should remove the timeout and update the handling there as well |
Native vs web/desktop implementation of the CreateMenu component On Safari and mobile browsers the attachment picker would not be triggered because `input.click()` is invoked after the CreateMenu is closed and `input` is consider destroyed this is why on Web we need to trigger the click before the CreateMenu closes On mobile native on the other hand triggering another modal needs to happen after CreateMenu closes otherwise the second modal wont appear
Updated When I originally added this logic, I tested on Android and I missed the fact that calling But the tricky part is on mobile web and Safari invoking an action after the first modal
That's why I've added a configuration regarding how menu items should be triggered in CreateMenu
|
Updated |
You are seeing a screenshot of the second modal - the popup that appears after you select "Upload Photo" from the options in the CreateMenu. It's appearance is handled by the browser. Maybe I should add a video for clarity. I'll do that when I get the chance |
No need, I'm with you. That's my screenshot btw. Gotcha, so it's simply because we have more control on mobile (we can show document picker/image picker/camera). Whereas on web we delegate this to the browser, which displays the native context menu? |
Correct To completely cover the topic, there's an alternative: You can have a https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/capture |
@Julesssss @tgolen |
Thanks for the bump, I will get it reviewed again now! |
Fix `icon` prop - it's not just any function It should be a react component - elementType
Updated (and merged latest from master) |
Updated |
Updated |
The test stage fails at "Install cocoapods". There are no changes in package or pods in this PR though |
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.
LGTM. The test was failing due to a missing Airship dependency, which has now been resolved. After re-running the test it succeeded.
@Julesssss
Details
Safari does not show the attachment picker if the button used to trigger file input disappears as soon as it's clicked
Added small updates to the
CreateMenu
components that preserve existing functionality but also allow totrigger an action before the CreateMenu popover closes
Fixed Issues
Fixes #2109 and also fixes: #1159
Tests
This bug affected mobile Safari, mobile Chrome and Desktop Safari
QA Steps
Same as above
Note: there are changes to the Create Menu component - the component used to show the "New Chat", "Group Chat" options on the home screen FAB, and the Attachment Picker component which is also used on "Edit Photo" for the profile picture.
I've verified they still work, but you should probably test it as well
Tested On
Screenshots
Web
Mobile Web (iPhone 8 Simulator Safari)
Mobile Web (iPhone 11 Pro Safari)
Mobile Web (Android Pixel 2 Chrome)