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

Web - Resizing browser triggers reaction emoji picker to shift to LHN #21982

Closed
1 of 6 tasks
kbecciv opened this issue Jun 30, 2023 · 8 comments
Closed
1 of 6 tasks

Web - Resizing browser triggers reaction emoji picker to shift to LHN #21982

kbecciv opened this issue Jun 30, 2023 · 8 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2

Comments

@kbecciv
Copy link

kbecciv commented Jun 30, 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. Open the app
  2. Open any report
  3. Keep your browser in non full screen mode
  4. Right click on any message and click on add reaction
  5. Click on browser full screen mode and observe that emoji picker is shifted over LHN

Expected Result:

App should not display emoji picker on LHN

Actual Result:

App displays reaction emoji picker on LHN when we resize browser

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: v1.3.34-1
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
Notes/Photos/Videos: Any additional supporting documentation

image (7)

emoji.picker.on.LHN.resize.mp4

Expensify/Expensify Issue URL:
Issue reported by: 1.3.34-1
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1688053285771839

View all open jobs on GitHub

@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 30, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 30, 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

@samh-nl
Copy link
Contributor

samh-nl commented Jun 30, 2023

Proposal

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

The emoji picker positions itself to the top-left corner of the screen if the window dimensions change.

What is the root cause of that problem?

The position of the emoji picker is dynamically updated if a dimension change is detected. An anchor (element) is used as a reference position.

const emojiPopoverDimensionListener = Dimensions.addEventListener('change', () => {
calculateAnchorPosition(emojiPopoverAnchor.current).then((value) => {
setEmojiPopoverAnchorPosition(value);
});
});

However, the anchor emojiPopoverAnchor.current element no longer exists after the window dimensions change due to a re-rendering. This causes the position to be x=0, y=0.

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

Close the emoji popover if the window dimensions change.

What alternative solutions did you explore? (Optional)

Recompute the new position based on the difference between the dimensions of the old and new situation.

@dummy-1111
Copy link
Contributor

dummy-1111 commented Jun 30, 2023

Proposal

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

Resizing browser triggers reaction emoji picker to shift to LHN

What is the root cause of that problem?

@samh-nl 's root cause is correct

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

When vertical === 0 and horizontal === 0, leave it unchanged.

    if (value.vertical === 0 && value.horizontal === 0) {
        return;
    }

    setEmojiPopoverAnchorPosition(value);

This works fine and wouldn't have any side effects

Result
21982.mp4

What alternative solutions did you explore? (Optional)

@samh-nl
Copy link
Contributor

samh-nl commented Jul 1, 2023

@s-alves10 The emoji picker will remain in the same coordinate if a return statement is added, however that position will be incorrect after resizing and no longer dynamically adjust. It would effectively be the same as removing Dimensions.addEventListener.

I have a revised proposal that solves the root cause and is a more elegant approach compared to my original proposal.

Proposal

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

The emoji picker positions itself to the top-left corner of the screen if the window dimensions change.

What is the root cause of that problem?

The anchor referenced by emojiPopoverAnchor.current (EmojiPicker.js) no longer exists. The context menu is used as the anchor, however after clicking "Add reaction" the context menu is closed, thereby removing the anchor and making repositioning based on the anchor position impossible.

const emojiPopoverDimensionListener = Dimensions.addEventListener('change', () => {
calculateAnchorPosition(emojiPopoverAnchor.current).then((value) => {
setEmojiPopoverAnchorPosition(value);
});
});

This causes the position to be x=0, y=0.

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

We need to use the same anchor that is used by BaseReportActionContextMenu (which is the chat message).

What alternative solutions did you explore? (Optional)

N/A

@daraksha-dk
Copy link
Contributor

Dupe of #17603
cc: @kadiealexander @kbecciv

@samh-nl
Copy link
Contributor

samh-nl commented Jul 1, 2023

The incorrect position is clearly a bug and can be addressed by using the same anchor as the context menu that precedes it. It's stated to be expected behavior without any elaboration, that is not a satisfactory reason in my opinion to dismiss a bug.

@kadiealexander
Copy link
Contributor

Agreed, dupe of #17603. Please post your proposals there. Thanks @daraksha-dk!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2
Projects
None yet
Development

No branches or pull requests

5 participants