Skip to content
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

[HOLD for payment 2024-12-19] [$250] Can't click Pay buttons when the edit composer is focused #53140

Closed
1 of 8 tasks
m-natarajan opened this issue Nov 26, 2024 · 36 comments
Closed
1 of 8 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@m-natarajan
Copy link

m-natarajan commented Nov 26, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.66-7
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
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
Expensify/Expensify Issue URL:
Issue reported by: @DylanDylann
Slack conversation (hyperlinked to channel name): ts_external_expensify_bugs

Action Performed:

  1. Go to any chat that waiting for you to pay
  2. Focus on main composer
  3. Click to dropdown button or pay button
  4. See that the action happen
  5. Click edit any message to display edit composer
  6. Click to dropdown button or pay button

Expected Result:

Click buttons should work normally

Actual Result:

Can't click buttons when the edit composer is focused

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Screen.Recording.2024-11-26.at.10.25.56.mov
Edit.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021862984432318114296
  • Upwork Job ID: 1862984432318114296
  • Last Price Increase: 2024-11-30
  • Automatic offers:
    • DylanDylann | Reviewer | 105207759
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @DylanDylann
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 26, 2024
Copy link

melvin-bot bot commented Nov 26, 2024

Triggered auto assignment to @adelekennedy (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@m-natarajan
Copy link
Author

@DylanDylann discovered this bug while reviewing #51172

@DylanDylann
Copy link
Contributor

I have more context with focus input while working on #51172. Could I take over this issue as C+ if it is external

@bernhardoj
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Pressing the pay button does nothing when the edit composer is focused and a keyboard is shown.

What is the root cause of that problem?

The root cause is the same as this old issue. When we press the pay button, the edit composer is blurred which triggers the main composer visibility, moving the view up, so the press event isn't caught by the button.

onBlur={(event: NativeSyntheticEvent<TextInputFocusEventData>) => {
setIsFocused(false);
const relatedTargetId = event.nativeEvent?.relatedTarget?.id;
if (relatedTargetId === CONST.COMPOSER.NATIVE_ID || relatedTargetId === CONST.EMOJI_PICKER_BUTTON_NATIVE_ID || EmojiPickerAction.isEmojiPickerVisible()) {
return;
}
setShouldShowComposeInputKeyboardAware(true);
}}

What changes do you think we should make in order to solve the problem?

We have a few options.

First, we can follow the same approach as #12715, that is by adding

onMouseDown={e => e.preventDefault()}

for the button. However, we need to apply this to all buttons/pressable in the chat list, including the reply text, etc.
image

The other solution is to delay showing the main composer.

export default setShouldShowComposeInputKeyboardAwareBuilder('keyboardDidHide');

setShouldShowComposeInputKeyboardAware for android & iOS, only shows the main composer after the keyboard hide, but web doesn't have the same thing. So, we can apply a 0 timeout for web only.

const setShouldShowComposeInputKeyboardAware: SetShouldShowComposeInputKeyboardAware = (shouldShow) => {
Composer.setShouldShowComposeInput(shouldShow);
};

const setShouldShowComposeInputKeyboardAware: SetShouldShowComposeInputKeyboardAware = (shouldShow) => {
    setTimeout(() => {
        Composer.setShouldShowComposeInput(shouldShow);
    }, 0);
};

or we can delay it using interaction manager and requestAnimationFrame.

InteractionManager.runAfterInteractions(() => {
requestAnimationFrame(() => {
reportScrollManager.scrollToIndex(index, true);
});
});

@melvin-bot melvin-bot bot added the Overdue label Nov 29, 2024
@melvin-bot melvin-bot bot removed the Overdue label Nov 30, 2024
@adelekennedy adelekennedy added External Added to denote the issue can be worked on by a contributor Overdue labels Nov 30, 2024
@melvin-bot melvin-bot bot changed the title Can't click Pay buttons when the edit composer is focused [$250] Can't click Pay buttons when the edit composer is focused Nov 30, 2024
Copy link

melvin-bot bot commented Nov 30, 2024

Job added to Upwork: https://www.upwork.com/jobs/~021862984432318114296

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 30, 2024
Copy link

melvin-bot bot commented Nov 30, 2024

Current assignee @DylanDylann is eligible for the External assigner, not assigning anyone new.

@adelekennedy
Copy link

@DylanDylann one proposal to review!

@melvin-bot melvin-bot bot removed the Overdue label Dec 2, 2024
@DylanDylann
Copy link
Contributor

@bernhardoj Could you explain why your first solution will solve this bug?

@bernhardoj
Copy link
Contributor

With the first solution, if we apply the prevent default on many pressable elements, pressing that element won't blur the edit composer, thus the main composer won't show and push the content above. I prefer the other solution though to use 0 timeout. This would make it closer to the native which waits for the keyboard to hide.

@DylanDylann
Copy link
Contributor

DylanDylann commented Dec 3, 2024

@bernhardoj

The root cause is the same as this old #12715. When we press the pay button, the edit composer is blurred which triggers the main composer visibility, moving the view up, so the press event isn't caught by the button.

As your explaination, when we click on the button, the keyboard is hidden and the position of the button is changed. If it is correct, why this bug doesn't happen on the main composer

@bernhardoj
Copy link
Contributor

I think it's just because for edit composer case, the edit composer moves the view instantly, so the mouse up isn't received anymore by the pressable which receives the first mouse down event. The press happens if the element receives both mouse down and up. You can try attaching onMouseDown and onMouseUp to the element (pay button or any else) and see it only receives the mouse down event.

@DylanDylann
Copy link
Contributor

I think it's just because for edit composer case, the edit composer moves the view instantly,

I mean that we need to clarify why there are differences between edit composer and main composer

@DylanDylann
Copy link
Contributor

The second solution looks fine but I want to make clear RCA to make sure that your fix is correct and doesn't cause any regression

@bernhardoj
Copy link
Contributor

I mean that we need to clarify why there are differences between edit composer and main composer

This is the difference

When we press the pay button, the edit composer is blurred which triggers the main composer visibility

@DylanDylann
Copy link
Contributor

DylanDylann commented Dec 5, 2024

@bernhardoj's proposal looks good to me. Let's use setTimeout 0

🎀 👀 🎀 C+ Reviewed

Copy link

melvin-bot bot commented Dec 5, 2024

Triggered auto assignment to @Beamanator, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 5, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Dec 6, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @DylanDylann

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Dec 12, 2024
@melvin-bot melvin-bot bot changed the title [$250] Can't click Pay buttons when the edit composer is focused [HOLD for payment 2024-12-19] [$250] Can't click Pay buttons when the edit composer is focused Dec 12, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 12, 2024
Copy link

melvin-bot bot commented Dec 12, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Dec 12, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.74-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-12-19. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Dec 12, 2024

@DylanDylann @adelekennedy @DylanDylann The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Dec 18, 2024
@adelekennedy
Copy link

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to comment:

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion:

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

Regression Test Proposal Template
  • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Regression Test Proposal

Precondition:

Test:

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot removed the Overdue label Dec 20, 2024
@adelekennedy
Copy link

@DylanDylann for the checklist above!

@adelekennedy
Copy link

Contributor: @bernhardoj paid $250 via NewDot
Contributor+: @DylanDylann owed $250 via Upwork

@bernhardoj
Copy link
Contributor

Requested in ND.

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

@melvin-bot melvin-bot bot added the Overdue label Dec 23, 2024
@DylanDylann
Copy link
Contributor

DylanDylann commented Dec 24, 2024

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to comment: It was missed from long time ago so It is hard to determine exactly what PR caused this problem

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion:

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

  • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Regression Test Proposal

Test:

  1. Open any chat with an unsettled expense
  2. Send a message and choose edit from the context menu
  3. Press on the pay button of the expense/report preview
  4. Verify the press is executed

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot removed the Overdue label Dec 24, 2024
Copy link

melvin-bot bot commented Dec 27, 2024

@Beamanator, @bernhardoj, @adelekennedy, @DylanDylann Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Dec 27, 2024
@adelekennedy
Copy link

created issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

6 participants