Skip to content

[HOLD for Payment 2024-09-6][$250] clicking enter on emoji selector for status results in leaving status pane #47272

Closed

Description

@m-natarajan

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: 9.0.19-2
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: @dylanexpensify
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1723475125409519

Action Performed:

  1. Head to status
  2. Click on emoji selector
  3. Search for any emoji
  4. When the emoji you want is auto-focused, hit enter

Expected Result:

emoji is selected and window for emoji search disappears

Actual Result:

emoji is not selected, and the RHP for status disappears

Workaround:

unknown

Platforms:

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

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

Screenshots/Videos

Recording.435.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01d3caa8f59dbe1758
  • Upwork Job ID: 1823486563046416835
  • Last Price Increase: 2024-08-13
  • Automatic offers:
    • rayane-djouah | Reviewer | 103586699
    • Krishna2323 | Contributor | 103586701
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    Daily
    Bug
    on Aug 12, 2024
  2. melvin-bot commented on Aug 12, 2024

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. Krishna2323 commented on Aug 12, 2024

    @Krishna2323
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-08-12 23:02:25 UTC.

    Proposal

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

    clicking enter on emoji selector for status results in leaving status pane

    What is the root cause of that problem?

    Form is submitted because of enter press.

    <FormProvider
    formID={ONYXKEYS.FORMS.SETTINGS_STATUS_SET_FORM}
    style={[styles.flexGrow1, styles.flex1]}
    ref={formRef}
    submitButtonText={translate('statusPage.save')}
    submitButtonStyles={[styles.mh5, styles.flexGrow1]}
    onSubmit={updateStatus}
    validate={validateForm}
    enabledWhenOffline
    >

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

    We should check if the emoji picker is active or not and if it is we will disable press on enter.

    disablePressOnEnter={EmojiPickerAction.isEmojiPickerVisible()}

    What alternative solutions did you explore? (Optional)

    We can focus on the message input box when the modal hides.

    onModalHide={() => {
        inputRef.current?.focus();
    }}

    What alternative solutions did you explore? (Optional 2)

    We can use useKeyboardShortcut to capture enter clicks and perform emoji selection.

        useKeyboardShortcut(
            CONST.KEYBOARD_SHORTCUTS.ENTER,
            () => {
                let indexToSelect = focusedIndex;
                if (highlightFirstEmoji) {
                    indexToSelect = 0;
                }
    
                const item = filteredEmojis[indexToSelect];
                if (!item) {
                    return;
                }
                if ('types' in item || 'name' in item) {
                    const emoji = typeof preferredSkinTone === 'number' && item?.types?.[preferredSkinTone] ? item?.types?.[preferredSkinTone] : item.code;
                    onEmojiSelected(emoji, item);
                }
            },
            {isActive: !isEnterWhileComposition(keyBoardEvent), shouldPreventDefault: true, shouldStopPropagation: true},
        );

    if (!isEnterWhileComposition(keyBoardEvent) && keyBoardEvent.key === CONST.KEYBOARD_SHORTCUTS.ENTER.shortcutKey) {
    let indexToSelect = focusedIndex;
    if (highlightFirstEmoji) {
    indexToSelect = 0;
    }
    const item = filteredEmojis[indexToSelect];
    if (!item) {
    return;
    }
    if ('types' in item || 'name' in item) {
    const emoji = typeof preferredSkinTone === 'number' && item?.types?.[preferredSkinTone] ? item?.types?.[preferredSkinTone] : item.code;
    onEmojiSelected(emoji, item);
    }
    // On web, avoid this Enter default input action; otherwise, it will add a new line in the subsequently focused composer.
    keyBoardEvent.preventDefault();
    // On mWeb, avoid propagating this Enter keystroke to Pressable child component; otherwise, it will trigger the onEmojiSelected callback again.
    keyBoardEvent.stopPropagation();
    return;
    }

  4. daledah commented on Aug 13, 2024

    @daledah
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-08-13 04:48:25 UTC.

    Proposal

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

    Emoji is not selected, and the RHP for status disappears

    What is the root cause of that problem?

    In FormProvider:


    the disablePressOnEnter param is false by default.

    When we open emoji picker then press on Enter, the onSubmit function is triggered:

    so the RHP is closed.

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

    When the emoji picker is showing, we shouldn't trigger updateStatus on Enter:

    const updateStatus = useCallback(

    by adding an early return logic:

                if(EmojiPickerAction.emojiPickerRef.current?.isEmojiPickerVisible){
                    return
                }
    

    bellow:

    ({emojiCode, statusText}: FormOnyxValues<typeof ONYXKEYS.FORMS.SETTINGS_STATUS_SET_FORM>) => {

    What alternative solutions did you explore? (Optional)

    1. We can create a new state:
        const [isEmojiPickerVisible, setIsEmojiPickerVisible] = useState(false);
    
    1. Then:

      will be:
                                onModalHide={() => setIsEmojiPickerVisible(false)}
                                onWillShow={() => setIsEmojiPickerVisible(true)}
    
    1. Then:

      will be:
                onWillShow,
    
    1. Then:

      will be:
                    disablePressOnEnter={isEmojiPickerVisible}
    
  5. daledah commented on Aug 13, 2024

    @daledah
    Contributor
  6. added
    External
    on Aug 13, 2024
  7. melvin-bot commented on Aug 13, 2024

    @melvin-bot
  8. changed the title [-] clicking enter on emoji selector for status results in leaving status pane[/-] [+][$250] clicking enter on emoji selector for status results in leaving status pane[/+] on Aug 13, 2024
  9. added
    Help Wanted
    on Aug 13, 2024
  10. melvin-bot commented on Aug 13, 2024

    @melvin-bot

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

  11. mallenexpensify commented on Aug 13, 2024

    @mallenexpensify
    Contributor

    Good catch @dylanexpensify I was able to reproduce. @rayane-djouah , plz review the proposals above.

    2024-08-13_15-27-05.mp4
  12. 27 remaining items

  13. changed the title [-][$250] clicking enter on emoji selector for status results in leaving status pane[/-] [+][HOLD for Payment 2024-09-6][$250] clicking enter on emoji selector for status results in leaving status pane[/+] on Sep 2, 2024
  14. mallenexpensify commented on Sep 2, 2024

    @mallenexpensify
    Contributor

    Thanks @rayane-djouah , and for linking the deploy checklist too

    @rayane-djouah , you might know the answer here in the related Slack thread.
    https://expensify.slack.com/archives/C01GTK53T8Q/p1725320002440979?thread_ts=1725050431.962859&cid=C01GTK53T8Q

  15. melvin-bot commented on Sep 6, 2024

    @melvin-bot

    @carlosmiceli, @mallenexpensify, @rayane-djouah, @Krishna2323 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  16. mallenexpensify commented on Sep 7, 2024

    @mallenexpensify
    Contributor

    Contributor: @Krishna2323 paid $250 via Upwork
    Contributor+: @rayane-djouah paid $250 via Upwork, can you please accept the job and reply here once you have?
    https://www.upwork.com/jobs/~01d3caa8f59dbe1758

    @rayane-djouah , can you also fill out the BZ checklist plz? thx

    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:

    • [@] The PR that introduced the bug has been identified. Link to the PR:
    • [@] 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:
    • [@] 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:
    • [@] Determine if we should create a regression test for this bug.
    • [@] 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.
    • [@bz] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  17. rayane-d commented on Sep 8, 2024

    @rayane-d
    Contributor

    Checklist

    • The PR that introduced the bug has been identified. Link to the PR: feat: implement useArrowKeyFocusManager in EmojiPickerMenu #34581
    • 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: feat: implement useArrowKeyFocusManager in EmojiPickerMenu #34581 (comment)
    • 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: N/A
    • Determine if we should create a regression test for this bug. Yes
    • 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

    1. Go to Settings > Status
    2. Click on the emoji selector
    3. Search for any emoji
    4. When the emoji you want is auto-focused, hit enter
    5. Verify that the emoji is selected and the message input is focused

    Do we agree 👍 or 👎

  18. rayane-d commented on Sep 8, 2024

    @rayane-d
    Contributor

    @mallenexpensify - Accepted the job and completed the checklist

  19. mallenexpensify commented on Sep 10, 2024

    @mallenexpensify
    Contributor

    Thanks @rayane-djouah , I updated the comment above to denote you've been paid.

    Test Case is here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDailyExternal

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions