Skip to content

[HOLD for payment 2023-04-07] Selecting an emoji using the tab focus and arrow keys shows a console error. #16348

Closed

Description

@kavimuru

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 Website
  2. Go to chat
  3. Open Emoji picker
  4. Press tab to focus and use arrow keys to select an emoji.
  5. Press enter.

Expected Result:

It shouldn't show any console errors.

Actual Result:

It shows a console error.

Workaround:

unknown

Platforms:

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

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

Version Number: 1.2.88-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
Notes/Photos/Videos:

Screen.Recording.2023-03-18.at.10.38.20.PM.1.mov
Screen.Recording.2023-03-21.at.15.26.40.mp4

Expensify/Expensify Issue URL:
Issue reported by: @Tushu17
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1679159494281019

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0143b6a68604602584
  • Upwork Job ID: 1638213725540528128
  • Last Price Increase: 2023-03-21

Activity

  1. added
    Daily
    Bug
    on Mar 21, 2023
  2. MelvinBot commented on Mar 21, 2023

    @MelvinBot
    Contributor

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

  3. MelvinBot commented on Mar 21, 2023

    @MelvinBot
    Contributor

    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
  4. self-assigned this
    on Mar 21, 2023
  5. BeeMargarida commented on Mar 21, 2023

    @BeeMargarida
    Contributor

    Hi, Ana from Callstack, I can pick this up

  6. added
    Internal
    on Mar 21, 2023
  7. MelvinBot commented on Mar 21, 2023

    @MelvinBot
    Contributor
  8. MelvinBot commented on Mar 21, 2023

    @MelvinBot
    Contributor

    Triggered auto assignment to Contributor Plus for review of internal employee PR - @Santhosh-Sellavel (Internal)

  9. locked and limited conversation to collaborators on Mar 21, 2023
  10. unlocked this conversation on Mar 21, 2023
  11. BeeMargarida commented on Mar 22, 2023

    @BeeMargarida
    Contributor

    Proposal

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

    When selecting a emoji from the emoji menu using arrow keys after pressing the tab key, it throws a console error.

    What is the root cause of that problem?

    The error happens because the scrollToHeader function is being called after the modal is closed (after the user selects the emoji with Enter). This function uses the emoji list reference, which is undefined since the emoji menu was closed.

    But why is this function being called when we press Enter on an emoji?

    When pressing the tab event before pressing enter on the highlighted emoji, the current keyDownHandler focuses on the search input and after pressing an arrow key, it focuses on the CategoryShortcutBar. When pressing enter, the currently focused one it the shortcut bar item, which will trigger the scrollToHeader function, but the dropdown has already closed.

    The default tab cycling logic is not being correctly supported, the only supported way is through arrow keys.

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

    The better solution would be to improve the Tab logic and remove the error. I propose the following:

    • Allow the EmojiPickerMenuItem to focus when it's being highlighted
      • pass a isFocused prop to EmojiPickerMenuItem, similar to the isHighlighted but only if keyboardMovement is available
    • Update the highlight when it's being focused
      • pass a onFocus prop to EmojiPickerMenuItem that will update the highlightedIndex when it's focused
    • Allow the default Tab behaviour to cycle through the items in menu
      • Add a check for keyBoardEvent.key === 'Tab' && keyBoardEvent.key === 'Shift' in keyDownHandler that just returns, allowing the default tab logic to execute
    • Allow the categories to also be focused by tab default behaviour
      • necessary to make the tooltip non focusable (or else it will cycle two times inside each button)
      • if key Enter is pressed outside the emoji list, it should use default behaviour

    What alternative solutions did you explore? (Optional)

    If we only want to remove the error and not improve the Tab logic, the quick solution would be returning early in scrollToHeader if this.emojiList is not defined, like:

    scrollToHeader(headerIndex) {
        if (!this.emojiList) {
            return;
        }
        const calculatedOffset = Math.floor(headerIndex / CONST.EMOJI_NUM_PER_ROW) * CONST.EMOJI_PICKER_HEADER_HEIGHT;
        this.emojiList.flashScrollIndicators();
        this.emojiList.scrollToOffset({offset: calculatedOffset, animated: true});
    }
  12. 47 remaining items

  13. Santhosh-Sellavel commented on May 1, 2023

    @Santhosh-Sellavel
    Collaborator

    @mountiny

    We missed handling tab navigation, so we kind of improvised it here. So this issue is not a regression we can skip the regression checklist.

    About the other issue #17194
    We know our first PR caused it. We partially added Tab & Tab + Shift navigation but we didn't fully test this one as we kind of planned to leave it for the later broader accessibility project, we kind of rushed into this made missed catching the Regression

  14. MelvinBot commented on May 1, 2023

    @MelvinBot
    Contributor

    Looks like something related to react-navigation may have been mentioned in this issue discussion.

    As a reminder, please make sure that all proposals are not workarounds and that any and all attempt to fix the issue holistically have been made before proceeding with a solution. Proposals to change our DeprecatedCustomActions.js files should not be accepted.

    Feel free to drop a note in #expensify-open-source with any questions.

  15. mountiny commented on May 2, 2023

    @mountiny
    Contributor

    I think this is all ready to be paid @dylanexpensify

    In this case we only have a reporting bonus to @Tushu17 and then C+ payment to @Santhosh-Sellavel

  16. dylanexpensify commented on May 4, 2023

    @dylanexpensify
    Contributor

    Getting a post up now!

  17. dylanexpensify commented on May 4, 2023

    @dylanexpensify
    Contributor

    @Santhosh-Sellavel @Tushu17 please apply here! 🙇

  18. Tushu17 commented on May 5, 2023

    @Tushu17
    Contributor

    @dylanexpensify Okay applied, Thank you.

  19. Santhosh-Sellavel commented on May 7, 2023

    @Santhosh-Sellavel
    Collaborator

    Applied @dylanexpensify thanks!

  20. dylanexpensify commented on May 8, 2023

    @dylanexpensify
    Contributor

    @Santhosh-Sellavel payment sent!
    RT here

  21. dylanexpensify commented on May 8, 2023

    @dylanexpensify
    Contributor

    @Tushu17 please accept offer so I can send you 💸 😄

  22. Tushu17 commented on May 8, 2023

    @Tushu17
    Contributor

    @dylanexpensify Offer accepted. Thank you.

  23. changed the title [-][HOLD for payment 2023-04-28] [HOLD for payment 2023-04-07] Selecting an emoji using the tab focus and arrow keys shows a console error.[/-] [+][HOLD for payment 2023-04-07] Selecting an emoji using the tab focus and arrow keys shows a console error.[/+] on May 8, 2023
  24. dylanexpensify commented on May 15, 2023

    @dylanexpensify
    Contributor

    All done!

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

Metadata

Metadata

Labels

Awaiting PaymentBugInternalWeekly

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions