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-09-13] [$1000] Emoji - When scrolling with the down arrows, the emoji selection disappears #24471

Closed
1 of 6 tasks
lanitochka17 opened this issue Aug 12, 2023 · 55 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 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Aug 12, 2023

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


Action Performed:

  1. Open https://staging.new.expensify.com/
  2. Open any conversation
  3. Open the emoji window
  4. Press the down arrow to scroll downward

Expected Result:

When scrolling with the down arrows, the emoji highlighting should remain in the user's field of view

Actual Result:

When scrolling with the down arrows, the emoji highlighting disappears, it wilts again after clicking on the other arrows

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome
  • MacOS / Desktop

Version Number: 1.3.53.1

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

Bug6161613_Recording_emoji.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018ba7fbfbb4ccc435
  • Upwork Job ID: 1692235536154705920
  • Last Price Increase: 2023-08-31
  • Automatic offers:
    • DrLoopFall | Contributor | 26458681
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 12, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 12, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 12, 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

@DrLoopFall
Copy link
Contributor

DrLoopFall commented Aug 12, 2023

Proposal

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

When scrolling with the down arrows, the emoji selection disappears

What is the root cause of that problem?

Currently, we're using CONST.NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT for scrolling the highlighted emoji, which is set to 300 pixels, but the actual height is 256 pixels, which leads to an incorrect calculation of the scroll offset.

targetOffset = offsetAtEmojiBottom - CONST.NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT;

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

Actually the scrollToHighlightedIndex is not needed as we already focus the selected emoji, which will automatically scroll to the emoji, it looks like scrollToHighlightedIndex was added as a workaround to fix the issue where the top row emoji was not scrolled properly due to using sticky headers.

We can completely remove scrollToHighlightedIndex and add scrollPaddingTop to the emoji list to fix the issue.

Add scrollPaddingTop in emoji list's style.

{scrollPaddingTop: isFiltered ? 0 : CONST.EMOJI_PICKER_ITEM_HEIGHT}

To scroll one row at a time change this and this

- this.ref.focus();
+ this.ref.focus({preventScroll: true});
+ this.ref.scrollIntoView({block: 'nearest'})

What alternative solutions did you explore? (Optional)

Changing the CONST.NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT to 256 pixels in src/CONST.js would fix the issue.

-    NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT: 300,
+    NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT: 256,

Or we can change CONST.EMOJI_PICKER_SIZE.HEIGHT to 460 pixels.

Alternate Solution 2

Use the actual height of the emoji picker list, for calculating the scroll offset.

@dummy-1111
Copy link
Contributor

Proposal

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

In EmojiPicker, the emoji highlight disappears when scroll with the down arrow

What is the root cause of that problem?

In order to scroll to the highlighted emoji, we're comparing the highlighted emoji position with CONST.NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT now as below

if (offsetAtEmojiBottom - this.currentScrollOffset >= CONST.NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT) {

This value is set to 300 now

NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT: 300,

But the height of EmojiPicker's list isn't always same with this value

The reasons are:

  1. In wide-screen devices, EmojiPicker's height is set to 416 as you can see below
    HEIGHT: 416,

This includes search input(height: 72), category bar(height: 32), EmojiPicker list, and skintone list(height: 56). EmojiPicker list has style flexShrink: 1, flexGrow: 1 and so its height becomes 256

  1. In small-screen devices, we don't explicityl set the height of the EmojiPicker as you can see below
    if (isSmallScreenWidth) {
    return {
    width: CONST.SMALL_EMOJI_PICKER_SIZE.WIDTH,
    };
    }

So the the height of the EmojiPicker list has the same value as CONST.NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT

  1. We have maxHeight style for the EmojiPicker list below
    maxHeight: windowHeight - dimensions,

This also affect the height of the EmojiPicker list

These are the root causes of this issue

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

We need to know the current height of the EmojiPicker list. In order to do this,

  1. Set NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT to 256
    NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT: 256,

This ensures the height of the EmojiPicker list is same as this value when maxHeight is larger than this.

  1. Update the below line to store the correct height to member variable
    const height = !listStyle.maxHeight || listStyle.height < listStyle.maxHeight ? listStyle.height : listStyle.maxHeight;
    const overflowLimit = Math.floor(height / CONST.EMOJI_PICKER_ITEM_HEIGHT) * 8;
        this.emojiListHeight = !listStyle.maxHeight || listStyle.height < listStyle.maxHeight ? listStyle.height : listStyle.maxHeight;
        const overflowLimit = Math.floor(this.emojiListHeight / CONST.EMOJI_PICKER_ITEM_HEIGHT) * 8;
  1. Use the stored height value when scrolling
    if (offsetAtEmojiBottom - this.currentScrollOffset >= CONST.NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT) {
    targetOffset = offsetAtEmojiBottom - CONST.NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT;
        if (offsetAtEmojiBottom - this.currentScrollOffset >= this.emojiListHeight) {
            targetOffset = offsetAtEmojiBottom - this.emojiListHeight;
        }

This works perfect for all cases

Result
24471.mp4

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Aug 14, 2023
@kevinksullivan kevinksullivan added the External Added to denote the issue can be worked on by a contributor label Aug 17, 2023
@melvin-bot melvin-bot bot changed the title Emoji - When scrolling with the down arrows, the emoji selection disappears [$1000] Emoji - When scrolling with the down arrows, the emoji selection disappears Aug 17, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 17, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 17, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 17, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 17, 2023

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

@kevinksullivan
Copy link
Contributor

Was OOO last week, pushing forward

@melvin-bot melvin-bot bot removed the Overdue label Aug 17, 2023
@Santhosh-Sellavel
Copy link
Collaborator

Thanks, @DrLoopFall, this seems like a regression to me. Any Idea where this got broken?

AFAIK It was working well few months or weeks ago

@DrLoopFall
Copy link
Contributor

DrLoopFall commented Aug 17, 2023

Hi @Santhosh-Sellavel,
Looks like it's caused by #18221 (f734e1c)

Also, I think we need to remove CONST.NON_NATIVE_EMOJI_PICKER_LIST_HEIGHT, so it sizes automatically with the emoji popup because now the emoji picker is resizable, so the emoji picker list height is not constant.

@redpanda-bit
Copy link
Contributor

a) Looks like the emoji picker scrolls on its own without needing the scrollToHighlightedIndex implementation. Maybe removing it fixes this issue.
b) I saw a significant improvement from using a throttle or debounce on the scrollToHighlightedIndex. Might be a race condition.

@TTaro
Copy link

TTaro commented Aug 18, 2023

Proposal

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

When navigating through the list using the arrow keys and holding down the key, the selected emoji disappears.

What is the root cause of that problem?

If the arrow key is held down, multiple keyboard events are generated, leading to race issues when calculating the highlighted emoji.

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

1 Add a new property in the constructor
IsKeyDownInProgress = false

2 In keyDownHandler we can avoid any calculation if IsKeyDownInProgress is true and if keyBoardEvent="ArrowDown" If not we continue and set IsKeyDownInProgress = true

3 As last step of keyDownHandler we change IsKeyDownInProgress = false , so next event can progress

@melvin-bot melvin-bot bot added the Overdue label Aug 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

@kevinksullivan, @Santhosh-Sellavel Whoops! This issue is 2 days overdue. Let's get this updated quick!

@kevinksullivan
Copy link
Contributor

Next step is for @Santhosh-Sellavel to review the comment here #24471 (comment)

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Aug 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 24, 2023

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

@kevinksullivan
Copy link
Contributor

Hi @Santhosh-Sellavel can you provide an ETA on when you'll be able to review this?. If it's not till next week I'm going to have to reassign.

@melvin-bot melvin-bot bot removed the Overdue label Aug 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 26, 2023

@kevinksullivan @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!

@melvin-bot
Copy link

melvin-bot bot commented Aug 31, 2023

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

@ArekChr
Copy link
Contributor

ArekChr commented Sep 1, 2023

@s-alves10 I've been trying to find the simplest way to fix the issue. I think @DrLoopFall was the first to understand and solve the root problem. Regarding your proposal, it works, and that's appreciated. However, I'm in favour of removing the scrolling logic by replacing scrollToHighlightedIndex with this.ref.scrollIntoView({block: 'nearest'}). It seems less like a workaround and more like a fix to the problem which will be less susceptible for regressions.

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

melvin-bot bot commented Sep 1, 2023

📣 @DrLoopFall 🎉 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 Sep 2, 2023

@kevinksullivan @ArekChr @jasperhuangg @DrLoopFall 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!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Sep 4, 2023
@DrLoopFall
Copy link
Contributor

@ArekChr @jasperhuangg
The PR #26633 is ready for review

@melvin-bot
Copy link

melvin-bot bot commented Sep 5, 2023

🎯 ⚡️ Woah @ArekChr / @DrLoopFall, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @DrLoopFall got assigned: 2023-09-01 20:42:02 Z
  • when the PR got merged: 2023-09-05 18:01:51 UTC

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Sep 6, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Emoji - When scrolling with the down arrows, the emoji selection disappears [HOLD for payment 2023-09-13] [$1000] Emoji - When scrolling with the down arrows, the emoji selection disappears Sep 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 6, 2023

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Sep 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 6, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.64-2 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-09-13. 🎊

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 Sep 6, 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:

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

@kevinksullivan
Copy link
Contributor

Hey @ArekChr please get to the checklist above when you have a chance!

@kevinksullivan
Copy link
Contributor

@DrLoopFall are you Afsar P on upwork? If yes, please accept the offer! And if not, pelase submit an application to the job

https://www.upwork.com/jobs/~018ba7fbfbb4ccc435

@DrLoopFall
Copy link
Contributor

@kevinksullivan Yes, I've accepted the offer.

@ArekChr
Copy link
Contributor

ArekChr commented Sep 11, 2023

Regression Test Proposal

  1. Open https://staging.new.expensify.com/
  2. Open emoji selector in any ocnversation
  3. Press the down arrow to scroll downward
  4. Verify if the focus doesn't lose after passing through the emojis categories selection header

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Sep 13, 2023
@kevinksullivan
Copy link
Contributor

All set with payments, closing out

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 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

9 participants