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 2023-10-24] [$500] keyboard opens for a second when user switches to password protected PDF #28841

Closed
2 of 6 tasks
m-natarajan opened this issue Oct 4, 2023 · 28 comments
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 Oct 4, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. go to any chat
  2. send a password protected PDF and one image or pdf
  3. click on password protected PDF
  4. click on enter password which will opens a keyboard
  5. click on Next or previous arrow
  6. again go to password protected PDF

Expected Result:

keyboard should not blink

Actual Result:

keyboard opens for a second

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.76-4
Reproducible in staging?: Yes
Reproducible in production?: Yes
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

Screen_Recording_20231004_125657_New.Expensify.mp4
RPReplay_Final1696404451.MP4
screen-20231004-123127.mp4

Expensify/Expensify Issue URL:
Issue reported by: @gadhiyamanan
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1696404454786079

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f0adb84bbc4bbe4e
  • Upwork Job ID: 1709618967047499776
  • Last Price Increase: 2023-10-04
  • Automatic offers:
    • tienifr | Contributor | 27140726
    • gadhiyamanan | Reporter | 27140730
Issue OwnerCurrent Issue Owner: @burczu
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 4, 2023

Triggered auto assignment to @johncschuster (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Oct 4, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@m-natarajan m-natarajan added the External Added to denote the issue can be worked on by a contributor label Oct 4, 2023
@melvin-bot melvin-bot bot changed the title keyboard opens for a second when user switches to password protected PDF [$500] keyboard opens for a second when user switches to password protected PDF Oct 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 4, 2023

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

@m-natarajan m-natarajan removed the Bug Something is broken. Auto assigns a BugZero manager. label Oct 4, 2023
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 4, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @burczu (External)

@m-natarajan m-natarajan added the Bug Something is broken. Auto assigns a BugZero manager. label Oct 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 4, 2023

Current assignee @johncschuster is eligible for the Bug assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Oct 4, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@micahelchan623
Copy link

micahelchan623 commented Oct 4, 2023

Proposal

Please re-state the issue
keyboard opens for a second

What is the root cause of the problem?
The keyboard did not unmount when navigate to the next screen

What changes do you think should be made to fix this problem?
add Keyboard.dismiss(); before submit password on PDFPasswordForm.js

    const submitPassword = () => {
        if (!validate()) {
            return;
        }
        Keyboard.dismiss();
        onSubmit(password);
    };

What other alternative options did you explore? (Optional)

@alitoshmatov
Copy link
Contributor

alitoshmatov commented Oct 4, 2023

Proposal

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

keyboard opens for a second when user switches to password protected PDF

What is the root cause of that problem?

The keyboard is opening while animation is running and this animation is causing the textfield to lose focus and keyboard to close.

The keyboard is opening when isFocused prop is true

useEffect(() => {
if (!isFocused) {
return;
}
if (!textInputRef.current) {
return;
}
textInputRef.current.focus();
}, [isFocused]);

And this prop is passed here
isFocused={activeSource === item.source}

This condition becomes immediately true when we switch to next carousel item without waiting for animation.

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

We should wait for the animation to complete and then focus the keyboard. We can achieve it by using isActive argument here which becomes true only after animation is completed

{renderItem({item, index, isActive: index === activePage})}

We can modify value of isFocus prop to also take isActive property into consideration, and it looks like this:

        ({item, isActive}) => (
            <CarouselItem
                item={item}
                isFocused={isActive && activeSource === item.source}
                onPress={() => setShouldShowArrows(!shouldShowArrows)}
            />
        ),

Result:

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-10-05.at.00.59.01.mp4

What alternative solutions did you explore? (Optional)

@tienifr
Copy link
Contributor

tienifr commented Oct 5, 2023

Proposal

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

keyboard opens for a second when user switches to password protected PDF

What is the root cause of that problem?

In

useEffect(() => {
if (!isFocused) {
return;
}
if (!textInputRef.current) {
return;
}
textInputRef.current.focus();
}, [isFocused]);

We're focusing on the input when isFocused change to true, but while navigating to this form, isFocused become true immediately while the animations are processing -> that dismiss the keyboard

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

we need to use isActive along with activeSource === item.source because isActive will be true when the scrolling is ended (e.offset !== 0)

// we use reanimated for this since onPageSelected is called
// in the middle of the pager animation
useAnimatedReaction(
() => isScrolling.value,
(stillScrolling) => {
if (stillScrolling) {
return;
}
runOnJS(setActivePage)(activeIndex.value);
},
);

Even after scrolling end, the keyboard is still dismissed because of navigating animations

We should focus the input after animations by following the recommendation

      useEffect(() => {
        if (!isFocused) {
            return;
        }
        if (!textInputRef.current) {
            return;
        }
        focusTimeoutRef.current = setTimeout(textInputRef.current.focus, CONST.ANIMATED_TRANSITION);
        return () => {
                if (!focusTimeoutRef.current) {
                    return;
                }
                clearTimeout(focusTimeoutRef.current);
            };
    }, [isFocused]);

Result

Screen.Recording.2023-10-05.at.18.14.22.mov

@melvin-bot melvin-bot bot added the Overdue label Oct 9, 2023
@burczu
Copy link
Contributor

burczu commented Oct 10, 2023

Just reviewed all the proposals.

The one from @micahelchan623 just doesn't work, and I don't think it is correct direction at all.

The solution proposed by @alitoshmatov is also incorrect: I don't think we want the text input to be focused right after we switches back to the password protected PDF from other image.

Only the proposal from @tienifr works as expected and I think it is a correct solution (even if it uses setTimeout but it is an approach advised by @roryabraham on Slack, as @tienifr pointed out), so I think we could proceed with it.

🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Oct 10, 2023

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

@hayata-suenaga
Copy link
Contributor

although I'm still hesitant to accept a solution that uses setTimeout, if Rory put a stamp on it, it must be unavoidable

let's go with @tienifr 👍

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 11, 2023

📣 @tienifr 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot
Copy link

melvin-bot bot commented Oct 11, 2023

📣 @gadhiyamanan 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 Weekly KSv2 labels Oct 11, 2023
@melvin-bot melvin-bot bot changed the title [$500] keyboard opens for a second when user switches to password protected PDF [HOLD for payment 2023-10-24] [$500] keyboard opens for a second when user switches to password protected PDF Oct 17, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 17, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 17, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 17, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.85-4 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 2023-10-24. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 17, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@burczu] The PR that introduced the bug has been identified. Link to the PR:
  • [@burczu] 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:
  • [@burczu] A discussion in #expensify-bugs 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:
  • [@burczu] Determine if we should create a regression test for this bug.
  • [@burczu] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@johncschuster] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Oct 24, 2023
@hayata-suenaga
Copy link
Contributor

waiting for the checklist to be completed and payments

@melvin-bot melvin-bot bot removed the Overdue label Oct 26, 2023
@johncschuster
Copy link
Contributor

I'll work on payments. @burczu, can you complete the checklist above?

@johncschuster
Copy link
Contributor

Payments to @tienifr and @gadhiyamanan have been issued!

@melvin-bot melvin-bot bot added the Overdue label Oct 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

@johncschuster, @burczu, @hayata-suenaga, @tienifr Whoops! This issue is 2 days overdue. Let's get this updated quick!

@hayata-suenaga
Copy link
Contributor

payments have been issued

@hayata-suenaga
Copy link
Contributor

I don't know why melvin is not removing overdue label 😭

@burczu
Copy link
Contributor

burczu commented Oct 31, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@burczu] The PR that introduced the bug has been identified. Link to the PR: Didn't identify such PR.
  • [@burczu] 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: n/a
  • [@burczu] A discussion in #expensify-bugs 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: n/a
  • [@burczu] Determine if we should create a regression test for this bug. I don't think so - the bug wasn't impactful and didn't break any important flow in the App.
  • [@burczu] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@johncschuster] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot removed the Overdue label Oct 31, 2023
@johncschuster
Copy link
Contributor

@burczu do you feel this issue requires us to add to our regression steps? If so, can you propose those steps?

@burczu
Copy link
Contributor

burczu commented Oct 31, 2023

@johncschuster As I wrote in my previous comment:

I don't think so - the bug wasn't impactful and didn't break any important flow in the App.

@melvin-bot melvin-bot bot added the Overdue label Nov 2, 2023
@johncschuster
Copy link
Contributor

Ah I missed that. Thanks!

@johncschuster
Copy link
Contributor

Closing!

@melvin-bot melvin-bot bot removed the Overdue label Nov 2, 2023
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

7 participants