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-02-07] [$500] Search - Focused account hidden by "Star a chat, get $250." when navigating with an arrow #34112

Closed
1 of 6 tasks
lanitochka17 opened this issue Jan 8, 2024 · 29 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 Internal Requires API changes or must be handled by Expensify staff

Comments

@lanitochka17
Copy link

lanitochka17 commented Jan 8, 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: 1.4.22-0
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. Login to NEwDot
  2. Click on the green + button
  3. Click on the "Start chat" option
  4. Go down the list around 10-15 accounts using keyboard arrows

Expected Result:

Focused account should be visible

Actual Result:

Focused account is hidden by "Star a chat, get $250." banner when navigating with an arrow

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • Windows: Chrome
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6335899_1704738005020.video_68.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~010450be8409118daf
  • Upwork Job ID: 1744446534096453632
  • Last Price Increase: 2024-01-15
  • Automatic offers:
    • c3024 | Reviewer | 28120212
    • bernhardoj | Contributor | 28120213
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jan 8, 2024
@melvin-bot melvin-bot bot changed the title Search - Focused account hidden by "Star a chat, get $250." when navigating with an arrow [$500] Search - Focused account hidden by "Star a chat, get $250." when navigating with an arrow Jan 8, 2024
Copy link

melvin-bot bot commented Jan 8, 2024

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

Copy link

melvin-bot bot commented Jan 8, 2024

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

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

melvin-bot bot commented Jan 8, 2024

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

Copy link

melvin-bot bot commented Jan 8, 2024

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

@ikevin127
Copy link
Contributor

ikevin127 commented Jan 8, 2024

Proposal

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

Focused account is hidden by referral "Star a chat, get $250." banner when navigating with Up / Down arrows.

What is the root cause of that problem?

This happens because when using navigating with Up / Down arrows the scrollToIndex() function from BaseOptionsSelector.js does not account for the extra spacing added by the introduction of the ReferralCTA at the bottom of the ScrollView and even though we focused the item, the focused item is hidden behind the referral element.

This can be easily reproduced by navigating from first to last item by pressing Up arrow once.

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

A solution for this case is to add negative viewOffset to the SectionList's scrollToLocation function which calls the scroll to the focused item. We only add negative offset for items with index > 0 so that the first item won't be affected by the offset and hidden.

Videos

MacOS: Chrome / Safari
Screen.Recording.2024-01-08.at.23.53.26.mov

@jayeshmangwani
Copy link
Contributor

I am not able to reproduce this issue on mac chrome, @ikevin127 are you able to reproduce the issue ?

@ikevin127
Copy link
Contributor

@jayeshmangwani I'm on MacOS too and I can repro on Chrome, Firefox and Safari.

It can be easily reproduced by navigating from first to last item by pressing Up arrow once.

@tienifr
Copy link
Contributor

tienifr commented Jan 9, 2024

Proposal

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

Focused account is hidden by "Star a chat, get $250." banner when navigating with an arrow

What is the root cause of that problem?

We're putting empty sections into SectionList inside OptionsSelector in NewChatPage, this causes the native SectionList to calculate scrolling distance incorrectly, leading to this issue. Meanwhile, other pages that also use BaseOptionsSelector but doesn't pass in empty sections, do not have this issue, for example the search page.

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

Filter out the empty sections before further processing, we can do this either before passing the sections into OptionsSelector (like NewChatPage), or inside BaseOptionsSelector itself (filtering the props.sections passed in)

This empty sections will not show in the UI at all and is safe to be removed. Then we can also remove the workarounds that we had to add because of the empty section like here

We need to also check other usage of BaseOptionsSelector in other pages and apply the same fix, and potentially double check the BaseSelectionList as well.

What alternative solutions did you explore? (Optional)

NA

@bernhardoj
Copy link
Contributor

Proposal

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

When scrolling through the new chat list with a keyboard arrow, the bottom items are hidden by the referral section.

What is the root cause of that problem?

In short: we scroll to the wrong index

Detail:
When we use the arrow key, it will call scrollToIndex for each item. We need a section and item index to scroll inside a SectionList. If we look at the scroll logic, we are reducing the section index for every empty section (section without data)

// Note: react-native's SectionList automatically strips out any empty sections.
// So we need to reduce the sectionIndex to remove any empty sections in front of the one we're trying to scroll to.
// Otherwise, it will cause an index-out-of-bounds error and crash the app.
let adjustedSectionIndex = sectionIndex;
for (let i = 0; i < sectionIndex; i++) {
if (_.isEmpty(lodashGet(this.state.sections, `[${i}].data`))) {
adjustedSectionIndex--;
}
}
this.list.scrollToLocation({sectionIndex: adjustedSectionIndex, itemIndex, animated});

And the reason for that is written in the comment above. But if we log inside the getItemLayout (the data, 1st param), we can see that the empty sections are still available on the list data, not stripped out.

On the new chat page, we have one empty section (index 0) for selected users (if we haven't select anyone),

const formatResults = OptionsListUtils.formatSectionsFromSearchTerm(searchTerm, selectedOptions, filteredRecentReports, filteredPersonalDetails, {}, false, indexOffset);
sectionsList.push(formatResults.section);
indexOffset = formatResults.newIndexOffset;

and then we have the Recents (index 1) and Contacts (index 2) section.

So, every time we call scrollToIndex, it will scroll to the previous section location, for example, when we are navigating through the Contacts section with an arrow key, instead of scrolling to section 2, we scroll to section 1 because of the assumption that empty section is strips out from the list. That's why the scrolling location is wrong.

(we can verify this root cause by selecting at least one user (to group) and the scrolling will work fine)

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

The reducing section index logic was added ~ 2 years ago, maybe the bug happened at that time, but looks like it's not relevant anymore with the proof of getItemLayout is still called for empty section. So, we can remove the reducing section index logic.

let adjustedSectionIndex = sectionIndex;
for (let i = 0; i < sectionIndex; i++) {
if (_.isEmpty(lodashGet(this.state.sections, `[${i}].data`))) {
adjustedSectionIndex--;
}
}

I have tested on all platforms and no error happens.

@zanyrenney
Copy link
Contributor

@c3024 please review the proposals.

@zanyrenney
Copy link
Contributor

bump @c3024 please review the proposals? If you do not have capacity to work on this issue, please let me know and I can reassign it.

@melvin-bot melvin-bot bot removed the Overdue label Jan 15, 2024
Copy link

melvin-bot bot commented Jan 15, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@c3024
Copy link
Contributor

c3024 commented Jan 15, 2024

Reviewing.

@c3024
Copy link
Contributor

c3024 commented Jan 17, 2024

Thanks for all your proposals.

I think compensating for the referral CTA is a workaround.

As the SectionList is not stripping away the empty sections, I think the simpler solution is to remove the code adjusting the index for scrolling.

So, @bernhardoj 's proposal here looks good to me.

🎀 👀 🎀 C+ Reviewed

Copy link

melvin-bot bot commented Jan 17, 2024

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

Copy link

melvin-bot bot commented Jan 22, 2024

@techievivek @zanyrenney @c3024 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!

@zanyrenney
Copy link
Contributor

this shouldn't be flagging as overdue, I have just bumped the eng team.

@zanyrenney
Copy link
Contributor

@melvin-bot melvin-bot bot removed the Overdue label Jan 23, 2024
@dangrous dangrous assigned dangrous and unassigned techievivek Jan 24, 2024
@dangrous
Copy link
Contributor

@c3024 your analysis seems correct, I think @bernhardoj has the simplest solution here and we can move forward!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 24, 2024
Copy link

melvin-bot bot commented Jan 24, 2024

📣 @c3024 🎉 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

Copy link

melvin-bot bot commented Jan 24, 2024

📣 @bernhardoj 🎉 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 📖

@bernhardoj
Copy link
Contributor

PR is ready

cc: @c3024

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jan 31, 2024
@melvin-bot melvin-bot bot changed the title [$500] Search - Focused account hidden by "Star a chat, get $250." when navigating with an arrow [HOLD for payment 2024-02-07] [$500] Search - Focused account hidden by "Star a chat, get $250." when navigating with an arrow Jan 31, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 31, 2024
Copy link

melvin-bot bot commented Jan 31, 2024

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

Copy link

melvin-bot bot commented Jan 31, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.33-5 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-02-07. 🎊

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

Copy link

melvin-bot bot commented Jan 31, 2024

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:

  • [@c3024] The PR that introduced the bug has been identified. Link to the PR:
  • [@c3024] 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:
  • [@c3024] 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:
  • [@c3024] Determine if we should create a regression test for this bug.
  • [@c3024] 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.
  • [@zanyrenney] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@c3024
Copy link
Contributor

c3024 commented Feb 4, 2024

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:

  • [@c3024] The PR that introduced the bug has been identified. Link to the PR: Standardize arrow navigation in OptionsLists #7702
  • [@c3024] 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: https://github.com/Expensify/App/pull/7702/files#r1477340685
  • [@c3024] 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: No discussion has been started because there appears nothing that can be improved in the PR checklist that could have identified this earlier.
  • [@c3024] Determine if we should create a regression test for this bug. Yes
  • [@c3024] 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.

Regression Test Proposal

The QA steps specified here is a suitable regression test

  1. Open new chat page
  2. Scroll down the list with the keyboard arrow down > 10 times
  3. Verify the list keeps scrolling to the bottom and that the focused user/option is not covered by the referral view (should be around the middle)

👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 6, 2024
@zanyrenney
Copy link
Contributor

payment summary:

@bernhardoj requires payment automatic offer (Contributor) PAID $500
@c3024 requires payment automatic offer (Reviewer) PAID $500

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 Internal Requires API changes or must be handled by Expensify staff
Projects
None yet
Development

No branches or pull requests

9 participants