-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[$1000] Remove Safari workaround to fix attachment picker issue #24297
Comments
Triggered auto assignment to @twisterdotcom ( |
This comment was marked as outdated.
This comment was marked as outdated.
Current assignee @twisterdotcom is eligible for the NewFeature assigner, not assigning anyone new. |
Triggered auto assignment to Design team member for new feature review - @shawnborton ( |
Doesn't need designing. |
Job added to Upwork: https://www.upwork.com/jobs/~01ce38317e6e2f0866 |
Current assignee @twisterdotcom is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Remove Safari workaround that enables file picker dialog to be opened. What is the root cause of that problem?A workaround was added because Safari allows popups, like the file input dialog, to be opened programmatically only when triggered directly by a user action. The problem lies in the App/src/components/PopoverMenu/index.js Lines 79 to 85 in c74032f
Before jumping to solution i would like to highlight that current Why so confusing logic with
|
const selectItem = (index) => { | |
const selectedItem = props.menuItems[index]; | |
props.onItemSelected(selectedItem, index); | |
setSelectedItemIndex(index); | |
}; |
Will result in
const selectItem = (index) => {
const selectedItem = props.menuItems[index];
props.onItemSelected(selectedItem, index);
InteractionManager.runAfterInteractions(() => {
selectedItem.onSelected();
});
};
I've tested on iOS managed to reproduce issue with unresponsive buttons and runAfterInteractions
fixes it.
@dangrous Please let me know your thoughts and if there's anything else I can add. 😉
ProposalPlease re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?Solution 1:
if (getOperatingSystem() === CONST.OS.IOS || Browser.isSafari()) {
InteractionManager.runAfterInteractions(() => {
selectedItem.onSelected();
});
} else {
selectedItem.onSelected();
} Pros for this solution:
Cons for this solution:
Solution 2:
const menuItems = [
...this.getMoneyRequestOptions(reportParticipants),
...this.getTaskOption(),
{
icon: Expensicons.Paperclip,
+ triggerOnItemSelected: getOperatingSystem() === CONST.OS.IOS || Browser.isSafari(), // Checking for 2 platforms as both needs to be handled this way.
text: this.props.translate('reportActionCompose.addAttachment'),
onSelected: () => {
if (Browser.isSafari()) {
return;
}
triggerAttachmentPicker();
},
},
];
const selectItem = (index) => {
const selectedItem = props.menuItems[index];
props.onItemSelected(selectedItem, index);
+ if (selectedItem.triggerOnItemSelected) {
+ selectedItem.onSelected();
+ }
setSelectedItemIndex(index);
};
<PopoverWithMeasuredContent
anchorPosition={props.anchorPosition}
anchorRef={props.anchorRef}
anchorAlignment={props.anchorAlignment}
onClose={props.onClose}
isVisible={props.isVisible}
onModalHide={() => {
setFocusedIndex(-1);
- if (selectedItemIndex !== null) {
+ if (selectedItemIndex !== null && !props.menuItems[selectedItemIndex].triggerOnItemSelected) {
props.menuItems[selectedItemIndex].onSelected();
setSelectedItemIndex(null);
}
}} Pros for this solution:
Cons for this solution:
What alternative solutions did you explore? (Optional)
|
Are these proposals any good @sobitneupane? |
Thanks for the proposal @alex2bc.
I agree with your reasoning for reverting the changes made in #19339. That will left us with #19310 issue. Can you please explain more about the issue. What's the cause of the issue? Using |
Thanks for the proposal @jeet-dhandha. Can you please add more details in the Root Cause Analysis. Solution 1 looks similar to this proposal. I didn't get your second proposal. Can you please add more details. Please make use of permalinks to refer to the files and code blocks where you are suggesting changes. |
Added few of the code samples. @sobitneupane Updated Proposal - #24297 (comment) |
@sobitneupane It's the issue of Currently, there is no non-workaround fix available. Some solutions suggested by community:
-<Modal isVisible={isVisible} />
+{isVisible ? <Modal/> : null} But it may affect performance of all modal in the app, so I don't think this is a good idea to change base modal rendering I agree that
Please let me know your thought on that |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Thanks for the update @jeet-dhandha. But probably, your solution will resurface #19310 issue. And also, it looks like a workaround. |
Thanks for the update @alex2bc. As @alex2bc suggested here, reverting #19339 PR will solve the issue in Safari and we can remove the workaround. But, it will recreate another issue. Looks like we don't have any way of solving the issue, without using some workaround like What's your thought on this @dangrous? |
Okay, if all of our possibilities are really just replacing one workaround with another (which I understand), I think we might be okay to just close this issue, and not complete. What do you think? |
I'd say that with this PR, we can replace two workarounds, one of which causes the other, with a single, more appropriate one for this problem |
We will be replacing workarounds with some other workaround. So, I agree on closing the issue. |
Apologies but I am finally going on Parental Leave. I am reassigning to another member of the team. But I also agree, we should close. |
Triggered auto assignment to @JmillsExpensify ( |
Triggered auto assignment to Design team member for new feature review - @dannymcclain ( |
Thanks! closing makes sense. |
I already tested this it works 👍 fine. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
In #19011 we added in a workaround for Safari's specific behavior for pop-ups and actions, because they always have to be triggered by a user action. This works, but is probably not ideal. Let's figure out a way to improve it!
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: