You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$1000] Web - On copy paste on workspace invite message page, app pastes text on compose box #23184
On invite message page, copy the current text and try to paste same text after it, observe that text is pasted in compose box behind
Expected Result:
App should paste text in invite message field if we copy and paste text while invite message field is in focus
Actual Result:
App pastes the text in compose box when we reload on members page, remove 1 member and invite any other and reach invite message paste
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Android / native
Android / Chrome
iOS / native
iOS / Safari
MacOS / Chrome / Safari
MacOS / Desktop
Version Number: 1.3.42-18 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation
Normally, when a modal is open, this function blocks due to the this.props.modal.isVisible inside the if-statement.
However, when deleting a member in a workspace, you are presented with a confirmation modal asking you whether you're sure. When this modal closes, this.props.modal.isVisible becomes false, therefore checkComposerVisibility returns true. This leads to the incorrect pasting behavior.
What changes do you think we should make in order to solve the problem?
When closing a modal, we should not set modal.isVisible to false if there are other modals opened.
What alternative solutions did you explore? (Optional)
Option 1. For ensuring that the composer is visible, we can check that the active route is NAVIGATORS.CENTRAL_PANE_NAVIGATOR, instead of checking whether a modal is active or not.
Option 2. When opening a modal, we determine the value of modal.isVisible. Subsequently, when closing the modal, we only set it to false if it was false initially. If a modal was already opened, we will not change its value.
Option 3. We could set the shouldSetModalVisibility prop to false in the ConfirmModal when deleting the member, however this may not be an elegant solution to the problem as this issue may also be present in other modals. We would need to identify where else a similar problem may arise.
Please re-state the problem that we are trying to solve in this issue.
The issue here is that the paste command is not working when trying to paste into invite message after deleting a user.
Investigation
After I looked into the error, I found that a paste issue is occuring also when we try to paste in the edited comment as it is a composer component same as the main chat composer.
When we try to paste into an edited comment, it also pastes into the main composer of the report open. Here is a video illustrating the issue.
bugPasting.webm
Thus, the root cause should be fixing the whole pasting mechanism as it occurs in multiple instances of components.
What is the root cause of that problem?
The first thing I did is investigating the paste function, and I found that there was a global paste event listener which is always called and triggered when the component mount here:
My first thought is that a general paste listener is not needed as we have handlePaste that will do the job, however, the issue here is if we delete the global pasting listener, this will not allow attachment or HTML pasting and they are handled differently.
The root cause, then, is that we are making the listener global for the entire HTML document, which affects all elements/components of the page. Thus, we need to handle it specifically for the input we are dealing with:
--> We need to use the textInput element istead of document where the listener then will be associated with only to the specific input!
What changes do you think we should make in order to solve the problem?
Please re-state the problem that we are trying to solve in this issue.
Web - On copy paste on workspace invite message page, app pastes text on compose box.
What is the root cause of that problem?
With normal flow, paste event will be removed when report page blurred by here. But when we use direct link, it won't happen and paste event still listen by here.
In handlePaste, we check checkComposerVisibility with the condition of modal.isVisiblehere. When we cancel ConfirmModal, it become false then checkComposerVisibility is true => not early return to block paste event to main composer.
What changes do you think we should make in order to solve the problem?
I think we shouldn't rely on modal key to focus or set value for composer.
We will do it when the active route is CentralPaneNavigator.
Creating a function in Navigation like below:
@johncschuster@parasharrajat@Santhosh-Sellavel this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@johncschuster@parasharrajat@Santhosh-Sellavel this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!
Activity
melvin-bot commentedon Jul 19, 2023
Triggered auto assignment to @johncschuster (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jul 19, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)samh-nl commentedon Jul 19, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Copy-paste on the workspace invite page leads to the text being pasted in the compose box.
What is the root cause of that problem?
When pasting to the composer, it checks
checkComposerVisibilityto ensure that the composer is visible:App/src/pages/home/report/ReportActionCompose.js
Lines 703 to 706 in 0fcfe75
Normally, when a modal is open, this function blocks due to the
this.props.modal.isVisibleinside the if-statement.However, when deleting a member in a workspace, you are presented with a confirmation modal asking you whether you're sure. When this modal closes,
this.props.modal.isVisiblebecomesfalse, thereforecheckComposerVisibilityreturnstrue. This leads to the incorrect pasting behavior.What changes do you think we should make in order to solve the problem?
When closing a modal, we should not set
modal.isVisibletofalseif there are other modals opened.What alternative solutions did you explore? (Optional)
Option 1. For ensuring that the composer is visible, we can check that the active route is
NAVIGATORS.CENTRAL_PANE_NAVIGATOR, instead of checking whether a modal is active or not.Option 2. When opening a modal, we determine the value of
modal.isVisible. Subsequently, when closing the modal, we only set it tofalseif it wasfalseinitially. If a modal was already opened, we will not change its value.Option 3. We could set the
shouldSetModalVisibilityprop to false in theConfirmModalwhen deleting the member, however this may not be an elegant solution to the problem as this issue may also be present in other modals. We would need to identify where else a similar problem may arise.yh-0218 commentedon Jul 19, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Copy-paste on the workspace invite page leads to the text being pasted in the compose box.
What is the root cause of that problem?
After reload, composer gets
paste eventand check value ofcheckComposerVisibilityfunction.App/src/pages/home/report/ReportActionCompose.js
Lines 703 to 706 in 0fcfe75
when closing
remove memberDialog,this.propos.modal.isVisiblebecomes to false.so composer gets the incorrect paste.
What changes do you think we should make in order to solve the problem?
When closing Modal, we should not set
ONYXKEYS.MODALvalue.App/src/pages/workspace/WorkspaceMembersPage.js
Lines 422 to 431 in fa473e9
we can add this
ConfirmModalofWorkspaceMembersPageWhat alternative solutions did you explore? (Optional)
makiour commentedon Jul 19, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
The issue here is that the paste command is not working when trying to paste into invite message after deleting a user.
Investigation
After I looked into the error, I found that a paste issue is occuring also when we try to paste in the edited comment as it is a composer component same as the main chat composer.
When we try to paste into an edited comment, it also pastes into the main composer of the report open. Here is a video illustrating the issue.
bugPasting.webm
Thus, the root cause should be fixing the whole pasting mechanism as it occurs in multiple instances of components.
What is the root cause of that problem?
The first thing I did is investigating the paste function, and I found that there was a global paste event listener which is always called and triggered when the component mount here:
App/src/components/Composer/index.js
Lines 176 to 178 in fa473e9
And will unmount here:
App/src/components/Composer/index.js
Line 210 in fa473e9
My first thought is that a general paste listener is not needed as we have handlePaste that will do the job, however, the issue here is if we delete the global pasting listener, this will not allow attachment or HTML pasting and they are handled differently.
The root cause, then, is that we are making the listener global for the entire HTML document, which affects all elements/components of the page. Thus, we need to handle it specifically for the input we are dealing with:
--> We need to use the textInput element istead of document where the listener then will be associated with only to the specific input!
What changes do you think we should make in order to solve the problem?
We need to change componentDidMount line:
App/src/components/Composer/index.js
Line 177 in fa473e9
to
this.textInput.addEventListener('paste', this.handlePaste);and componentWillUnmount line:
App/src/components/Composer/index.js
Line 210 in fa473e9
To
this.textInput.removeEventListener('paste', this.handlePaste);What alternative solutions did you explore? (Optional)
N/A
dukenv0307 commentedon Jul 20, 2023
it seems that this PR causes regression #21583
johncschuster commentedon Jul 21, 2023
Heads up, @robertKozik
ginsuma commentedon Jul 22, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Web - On copy paste on workspace invite message page, app pastes text on compose box.
What is the root cause of that problem?
With normal flow,
pasteevent will be removed when report page blurred by here. But when we use direct link, it won't happen andpasteevent still listen by here.In
handlePaste, we checkcheckComposerVisibilitywith the condition ofmodal.isVisiblehere. When we cancelConfirmModal, it becomefalsethencheckComposerVisibilityistrue=> not early return to blockpasteevent to main composer.What changes do you think we should make in order to solve the problem?
I think we shouldn't rely on
modalkey to focus or set value for composer.We will do it when the active route is
CentralPaneNavigator.Creating a function in
Navigationlike below:Then change
checkComposerVisibilityto:What alternative solutions did you explore? (Optional)
We can use
isCPNRouteto other issues about focusing main composer here.robertKozik commentedon Jul 24, 2023
thanks @johncschuster for mentioning. Looking into it as indeed it's regression
30 remaining items
melvin-bot commentedon Aug 2, 2023
@johncschuster @parasharrajat @Santhosh-Sellavel this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
johncschuster commentedon Aug 2, 2023
It seems the issue is no longer reproducible. Holding.
Santhosh-Sellavel commentedon Aug 7, 2023
Just on hold, for now, discussion in Slack here
johncschuster commentedon Aug 7, 2023
Thanks for the heads up, @Santhosh-Sellavel!
melvin-bot commentedon Aug 9, 2023
@johncschuster @parasharrajat @Santhosh-Sellavel this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!
Santhosh-Sellavel commentedon Aug 9, 2023
@johncschuster We decided not to revert the PR, so we can close this one and just issue reporting bonus here. As this one is already fixed.
johncschuster commentedon Aug 14, 2023
Payment has been issued to the bug reporter (@dhanashree-sawant). Closing!