Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.54k stars 2.89k forks source link

[HOLD for payment 2024-03-11] [HOLD for payment 2024-02-19] [$500] mWeb - Workspace - "Next" button's placement has a delay after the keypad disappears #33546

Closed kbecciv closed 6 months ago

kbecciv commented 10 months ago

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: 1.4.16.3 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 Expensify/Expensify Issue URL: Issue reported by: Applause - Internal Team Slack conversation:

Action Performed:

  1. Navigate to https://staging.new.expensify.com/
  2. Log in with an expensifail account
  3. Create a workspace
  4. Invite a new member
  5. Type in the full email address and make sure that the keypad is visible
  6. Tap on the checkbox next to the email

Expected Result:

There shouldn't be a delay.

Actual Result:

"Next" button's placement has a delay after the keypad disappears.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/93399543/dc17851c-df3b-4063-9001-65e785c39587

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01241daac204a80575
  • Upwork Job ID: 1738559249320325120
  • Last Price Increase: 2023-12-30
  • Automatic offers:
    • shubham1206agra | Reviewer | 28088091
    • suneox | Contributor | 28088092
Issue OwnerCurrent Issue Owner: @shubham1206agra
melvin-bot[bot] commented 10 months ago

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

melvin-bot[bot] commented 10 months ago

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

melvin-bot[bot] commented 10 months ago

Bug0 Triage Checklist (Main S/O)

melvin-bot[bot] commented 10 months ago

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

maazakn commented 10 months ago

When adding a new member, the button lags whenever the keypad is opened or closed, regardless of whether a checkbox is selected.

melvin-bot[bot] commented 10 months ago

πŸ“£ @maazakn! πŸ“£ Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
samuelralak commented 10 months ago

Contributor details Your Expensify account email: thesamuelralak@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~011e010bd867c901e3

Proposal

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

What is the root cause of that problem?

Mismatch in timing of the keyboard's retraction animation and button's position update

A similar behaviour can be observed in the following routes:

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

Quick

Set shouldEnableMaxHeight prop of ScreenWrapper to false or just don't include it. This makes the button position static, gracefully hiding it behind the keyboard when input is in focus thus maintaining a consistent user experience with the following routes:

Long Term

Incorporate the KeyboardAvoidingView component, along with appropriate padding and animation configurations, to automatically adjust the layout when the keyboard is visible. Disclaimer - this is a trial and error approach, mostly due to my limited familiarity with the codebase now.

What alternative solutions did you explore? (Optional)

melvin-bot[bot] commented 10 months ago

βœ… Contributor details stored successfully. Thank you for contributing to Expensify!

bfitzexpensify commented 10 months ago

Proposal in https://github.com/Expensify/App/issues/33546#issuecomment-1868421370 ready for review when you get a moment @shubham1206agra

suneox commented 10 months ago

Proposal

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

mWeb - Workspace - "Next" button's placement has a delay after the keypad disappears

What is the root cause of that problem?

The windowHeight get from useWindowDimensions return is delayed after the keyboard open or close, due to indeep the implemetation at react-native-web using window.visualViewport and the resize event from window.visualViewport isn't triggered immediately after the keyboard opens or closes.

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

This issue also happen on a lot of page has ScreenWrapper using shouldEnableMaxHeight so we will apply one fix for all page. At hook useWindowDimensions for web we will create varible initalViewportHeight and cachedViewportHeight if Browser.isMobile we will add listener focusin and focusout for input, textarea, ...element can trigger keyboard, If keyboard is open we will set windowHeight to cachedViewportHeight and when keyboard is close we will set windowHeight to initalViewportHeight

    const [windowHeight, setWindowHeight] = useState(height);

    const handleFocusIn = (event: FocusEvent) => {
        const targetElement = event.target as HTMLElement;
        if (targetElement.tagName === "INPUT" || targetElement.tagName === "TEXTAREA") {
            setWindowHeight(cachedViewportHeight);
        }
    }
    useEffect(() => {
        if (!Browser.isMobileSafari()) return;
        window.addEventListener('focusin', handleFocusIn)
        return () => {
            window.removeEventListener('focusin', handleFocusIn)
        }
    },[]);

    const handleFocusOut = (event: FocusEvent) => {
        const targetElement = event.target as HTMLElement;
        if (targetElement.tagName === "INPUT" || targetElement.tagName === "TEXTAREA") {
            setWindowHeight(initalViewportHeight);
        }
    }

    useEffect(() => {
        if (!Browser.isMobileSafari()) return;
        window.addEventListener('focusout', handleFocusOut)
        return () => {
            window.removeEventListener('focusout', handleFocusOut)
        }
    },[])

    useEffect(() => {
        // check is mobile browser and portrait mode
        if (Browser.isMobileSafari() && height > windowWidth) {
            if (height < initalViewportHeight) {
                cachedViewportHeight = height;
            }
        }
        setWindowHeight(height);
    }, [windowWidth, height])

We also can update condition useWindowDimensions at ScreenWrapper only handle when shouldEnableMaxHeight is true and Browser.isMobileSafari(), some thing like that to reduce affect for code change above

    const {windowHeight, isSmallScreenWidth} = useWindowDimensions({shouldHandleKeyboardOpenHeight: shouldEnableMaxHeight && Browser.isMobileSafari()});

full implementation at this commit

POC: After fix https://github.com/Expensify/App/assets/11959869/8bc6f61b-ff93-453d-ac0b-def596942dec
Before fix https://github.com/Expensify/App/assets/11959869/b6eabf45-161d-4b56-9ea2-075555dbd4a1

What alternative solutions did you explore? (Optional)

shubham1206agra commented 10 months ago

@suneox The proposal looks promising (I just need to test it on few different cases). I have some questions about it

Why can't we do the fix upstream in this case?

suneox commented 10 months ago

Hi @shubham1206agra

Why can't we do the fix upstream in this case?

We should fix it inside the app implementation because we have a specific use case. Currently, this hook is used on a lot of pages so we don't have the context to make the assumption

I have cleanup the code lint for my change at this commit could you please check-out it to verify?

melvin-bot[bot] commented 10 months ago

@bfitzexpensify, @shubham1206agra Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

bfitzexpensify commented 10 months ago

Thoughts on https://github.com/Expensify/App/issues/33546#issuecomment-1869276001 @shubham1206agra?

shubham1206agra commented 10 months ago

Sorry @bfitzexpensify. I haven't tested this yet. I will test this today.

melvin-bot[bot] commented 10 months ago

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] commented 10 months ago

@bfitzexpensify, @shubham1206agra Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

bfitzexpensify commented 10 months ago

Any update here @shubham1206agra?

shubham1206agra commented 10 months ago

@bfitzexpensify I have checked this problem. The solution works on ios mweb, but still seems sluggish on android mweb. Can we have someone from expert group for this bug? Or maybe @suneox create a PR and test this on real device on adhoc build.

@suneox I noticed some delay on first opening of keyboard on iOS. Is this by design?

suneox commented 10 months ago

The solution works on ios mweb, but still seems sluggish on android mweb. Can we have someone from expert group for this bug? Or maybe @suneox create a PR and test this on real device on adhoc build.

@shubham1206agra I just tested on a real Android device and this issue only happens on ios Safari so we just need to change the condition check Browser.isMobile to Browser.isMobileSafari() Could you please re-verify at this commit?

I noticed some delay on first opening of keyboard on iOS. Is this by design?

Yes my proposal is caching the ViewportHeight so we have to get the viewport height while the first time opens keyboard, and it still matches the expectation when the keyboard is hidden the button will fixed to the bottom immediately

shubham1206agra commented 10 months ago

@suneox's proposal looks good to me.

πŸŽ€ πŸ‘€ πŸŽ€ C+ Reviewed

Additional note - Lag in Android mWeb most probably due to device problem, and not App issue.

melvin-bot[bot] commented 10 months ago

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

melvin-bot[bot] commented 10 months ago

@techievivek @bfitzexpensify @shubham1206agra 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!

melvin-bot[bot] commented 10 months ago

πŸ“£ @shubham1206agra πŸŽ‰ An offer has been automatically sent to your Upwork account for the Reviewer role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job

melvin-bot[bot] commented 10 months ago

πŸ“£ @suneox πŸŽ‰ 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 πŸ“–

suneox commented 10 months ago

Hi @shubham1206agra PR is ready for review

melvin-bot[bot] commented 9 months ago

This issue has not been updated in over 15 days. @suneox, @techievivek, @bfitzexpensify, @shubham1206agra eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

suneox commented 9 months ago

Hi @techievivek @shubham1206agra I would like to confirm the viewport delay only happens on mWeb/Safari we can check on the latest staging on your real device mobile device (iOS/Safari & Android/Chrome)

The latest staging iOS/Safari Android/Chrome

https://github.com/Expensify/App/assets/11959869/8a63eabd-b582-4827-86e1-6f2d6bba3029

https://github.com/Expensify/App/assets/11959869/063688f2-079a-4c3d-98ac-4260bc15d176

The raw structure at this link iOS/Safari Android/Chrome

https://github.com/Expensify/App/assets/11959869/5d1f5232-d15a-4175-9297-374a35d623fe

https://github.com/Expensify/App/assets/11959869/273fce4d-fb0d-4307-8f08-c2f5d55a7214

melvin-bot[bot] commented 9 months ago

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

melvin-bot[bot] commented 9 months ago

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

melvin-bot[bot] commented 9 months ago

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

If no regressions arise, payment will be issued on 2024-02-19. :confetti_ball:

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

melvin-bot[bot] commented 9 months ago

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:

Julesssss commented 9 months ago

Holding payment on the regression

suneox commented 9 months ago

@shubham1206agra Could you please review this PR to fix regression?

bfitzexpensify commented 8 months ago

PR is merged

getusha commented 8 months ago

Looks like this caused another regression https://github.com/Expensify/App/issues/37090 @shubham1206agra @suneox

shubham1206agra commented 8 months ago

The bug looks serious to me. Should I raise a revert for now in this case?

@suneox Meanwhile, please investigate this bug ASAP.

suneox commented 8 months ago

The bug looks serious to me. Should I raise a revert for now in this case?

@suneox Meanwhile, please investigate this bug ASAP.

@shubham1206agra I'll double-check and create PR within 1 hour by adding props to ScreenWrapper only handle the workspace screen instead of apply for all page, base on a page structure we will handle case by case

suneox commented 8 months ago

The PR is ready to create but the issue doesn't happen at PR so I'd like to continue to double check the related issues in few hours

suneox commented 8 months ago

@shubham1206agra I have created PR to fix case by case, first we can go ahead with this page due to we don't have a context to fix as globally, some page has a magic logic against with this.

suneox commented 8 months ago

Friendly bump @shubham1206agra

melvin-bot[bot] commented 8 months ago

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

melvin-bot[bot] commented 8 months ago

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

If no regressions arise, payment will be issued on 2024-03-11. :confetti_ball:

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

melvin-bot[bot] commented 8 months ago

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:

bfitzexpensify commented 8 months ago

Switching this to Daily so that I'm on top of payment

bfitzexpensify commented 8 months ago

Payment due Monday

melvin-bot[bot] commented 8 months ago

@suneox, @techievivek, @bfitzexpensify, @shubham1206agra Whoops! This issue is 2 days overdue. Let's get this updated quick!

bfitzexpensify commented 8 months ago

Payment complete for @suneox

@shubham1206agra, I had to re-issue your contract, that's been sent now. Also, a bump on the BZ checklist - thanks!

shubham1206agra commented 8 months ago

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:

  1. Navigate to App.
  2. Go to a workspace in which you want to invite the member.
  3. Type in the full email address and ensure the keypad is visible.
  4. Tap on the checkbox next to the email.
shubham1206agra commented 8 months ago

@bfitzexpensify Can you hold my payment temporarily as per https://expensify.slack.com/archives/C02NK2DQWUX/p1710150138788529?