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 #23959] Web - RHN - Opening RHN after opening the emoji picker will keep the composer focused #25584

Closed
1 of 6 tasks
izarutskaya opened this issue Aug 21, 2023 · 34 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause Weekly KSv2

Comments

@izarutskaya
Copy link

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 any chat
  2. Open emoji picker
  3. Click on profile avatar

Expected Result:

The composer should not be focused.

Actual Result:

The composer is focused and can type on it.

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.55-7

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

Screen.Recording.2023-08-11.At.12.36.44.Pm.mp4
20230821_200321.mp4

Expensify/Expensify Issue URL:

Issue reported by: @getusha

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1691746780206579

View all open jobs on GitHub

@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

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

@melvin-bot
Copy link

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

@alitoshmatov
Copy link
Contributor

alitoshmatov commented Aug 21, 2023

Proposal

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

Web - RHN - Opening RHN after opening the emoji picker will keep the composer focused

What is the root cause of that problem?

When emoji picker popover is closed it is automatically focusing to composer, and this line is responsible for this:

onModalHide={() => focus(true)}

Hiding modal comes before pressing event and expected behavior should be hide modal -> focus composer -> press event(which should unfocus composer) but since we are focusing in InteractionManager.runAfterInteractions it is causing focus event to be executed lastly like so hide modal -> press event -> focus composer
https://github.com/Expensify/App/blob/f600d338ac1778ee7bc8383d691b04f720783446/src/libs/focusWithDelay/focusWithDelay.js#L22C1-L22C1

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

I think this logic causes a lot of unexpected focuses in composer, like it is not just RHN but pressing anything after opening emoji picker results in the same. For example pressing search after emoji picker causes focus to be in composer and not in search page, or pressing FAB you can't use up/down buttons because focus is still in composer.

That is why, I think we should completely get rid of this logic.
But we should modify here:

onEmojiSelected={replaceSelectionWithText}

So that when emoji is picked we focus back in composer

What alternative solutions did you explore? (Optional)

One more solution is to execute focus event immediately not inside InteractionManager.runAfterInteractions, we can achieve it by passing addition argument to focusWithDelay function. Since emoji picker closing does not have any animation, it should not cause any issue.

@samh-nl
Copy link
Contributor

samh-nl commented Aug 21, 2023

Proposal

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

Opening RHN after opening the emoji picker will keep the composer focused

What is the root cause of that problem?

When the emoji picker closes, the focus the composer:

<EmojiPickerButton
isDisabled={isBlockedFromConcierge || disabled}
onModalHide={() => focus(true)}
onEmojiSelected={replaceSelectionWithText}
/>

However, we are not checking checkComposerVisibility() inside the focus function.

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

If the composer is not visible, we should not continue to focus the composer.
The checkComposerVisibility output should be stored in a ref to ensure the value is up to date and passed to focusWithDelay.

In ReportActionCompose.js:

- focusWithDelay(textInputRef.current)(shouldDelay);
+ focusWithDelay(textInputRef.current)(shouldDelay, () => composerVisibility.current);

In focusWithDelay.js:

function focusWithDelay(disableDelay = false) {
    ...
-	(shouldDelay = false) => {
+	(shouldDelay = false, shouldFocusAfterInteractions = () => true) => {
            ...
            InteractionManager.runAfterInteractions(() => {
-               if (!textInput) {
+               if (!textInput || !shouldFocusAfterInteractions()) {
                    return;
                }
                ...

What alternative solutions did you explore? (Optional)

N/A

@ginsuma
Copy link
Contributor

ginsuma commented Aug 21, 2023

Proposal

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

Opening RHN after opening the emoji picker will keep the composer focused

What is the root cause of that problem?

onModalHide, we focus the composer without checking whether the report page is focused or not.

<EmojiPickerButton
isDisabled={isBlockedFromConcierge || disabled}
onModalHide={() => focus(true)}
onEmojiSelected={replaceSelectionWithText}

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

We use isFocusedProp in the focus here. If it is false, we won't focus.

@bernhardoj
Copy link
Contributor

The root cause is we are focusing the composer with a delay in closing the emoji picker. We have a plan to remove the delay in this issue, but we are waiting for upstream PRs which would take an unknown amount of time. If waiting is fine, we can hold this one.

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

melvin-bot bot commented Aug 25, 2023

@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

@mallenexpensify Still overdue 6 days?! Let's take care of this!

@mallenexpensify
Copy link
Contributor

Thanks @bernhardoj for the context
Going to put on hold pending #23959

@melvin-bot melvin-bot bot removed the Overdue label Aug 30, 2023
@mallenexpensify mallenexpensify added Weekly KSv2 Planning Changes still in the thought process and removed Daily KSv2 labels Aug 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 4, 2023

@mallenexpensify this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Sep 4, 2023
@mallenexpensify mallenexpensify added Weekly KSv2 and removed Daily KSv2 labels Sep 5, 2023
@mallenexpensify mallenexpensify changed the title Web - RHN - Opening RHN after opening the emoji picker will keep the composer focused [HOLD #23959] Web - RHN - Opening RHN after opening the emoji picker will keep the composer focused Sep 5, 2023
@mallenexpensify
Copy link
Contributor

Updated title and moved to weekly

@melvin-bot melvin-bot bot added the Overdue label Sep 13, 2023
@mallenexpensify
Copy link
Contributor

@melvin-bot melvin-bot bot removed the Overdue label Sep 19, 2023
@melvin-bot melvin-bot bot added the Overdue label Sep 27, 2023
@mallenexpensify
Copy link
Contributor

Holding on upstream

@melvin-bot melvin-bot bot removed the Overdue label Oct 4, 2023
@mallenexpensify
Copy link
Contributor

Holding

@mallenexpensify
Copy link
Contributor

Held issue got downgraded to Monthly, so this one might be a while. Adding to #vip-vsb cuz it doesn't involve money.

@melvin-bot melvin-bot bot added the Overdue label Apr 5, 2024
@mallenexpensify mallenexpensify added Monthly KSv2 and removed Weekly KSv2 labels Apr 10, 2024
@melvin-bot melvin-bot bot removed the Overdue label Apr 10, 2024
@mallenexpensify
Copy link
Contributor

Bumped to monthly cuz held issue was bumped to monthly

@melvin-bot melvin-bot bot added the Overdue label May 13, 2024
@mallenexpensify
Copy link
Contributor

Holdin'

@melvin-bot melvin-bot bot removed the Overdue label May 15, 2024
@melvin-bot melvin-bot bot added the Overdue label Jun 17, 2024
@mallenexpensify
Copy link
Contributor

@melvin-bot melvin-bot bot removed the Overdue label Jun 19, 2024
@melvin-bot melvin-bot bot added the Overdue label Jul 22, 2024
@mallenexpensify
Copy link
Contributor

PR for issue we're held on is waiting review
#23959 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Jul 24, 2024
@melvin-bot melvin-bot bot added the Overdue label Aug 26, 2024
@mallenexpensify mallenexpensify added Weekly KSv2 and removed Monthly KSv2 labels Aug 28, 2024
@melvin-bot melvin-bot bot removed the Overdue label Aug 28, 2024
@mallenexpensify mallenexpensify added Monthly KSv2 Overdue and removed Planning Changes still in the thought process labels Aug 28, 2024
@melvin-bot melvin-bot bot removed the Overdue label Aug 28, 2024
@mallenexpensify mallenexpensify added retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause and removed Monthly KSv2 labels Aug 28, 2024
@mallenexpensify
Copy link
Contributor

UI is drastically changed since this was reported over a year ago, closing, unable to reproduce

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. retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause Weekly KSv2
Projects
No open projects
Status: No status
Development

No branches or pull requests

6 participants