Skip to content

[$1000] mWeb - Long pressing message shows item selected in Menu at the touch point #23191

Closed

Description

@kbecciv

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 any chat
  2. Long press on any message to open menu
    (Long press at the position when any item of menu can be hit)

Expected Result:

It should just open the menu

Actual Result:

It opens the menu with item hovered effect

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: 1.3.42-19
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

RPReplay_Final1689706235.mp4
Image.from.iOS.1.MOV

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~011ecfe619c9cb6746
  • Upwork Job ID: 1682074494185332736
  • Last Price Increase: 2023-08-03

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 19, 2023
  2. melvin-bot commented on Jul 19, 2023

    @melvin-bot

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

  3. melvin-bot commented on Jul 19, 2023

    @melvin-bot

    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. allroundexperts commented on Jul 19, 2023

    @allroundexperts
    Contributor

    Proposal

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

    Long pressing message shows item selected in Menu at the touch point

    What is the root cause of that problem?

    The root cause of the issue is that we're wrapping MenuItem inside Hoverable component. The Hoverable component uses onMouseEnter and onMouseLeave events to set the hover state. These events are supported on web but not on mobile browsers. This is causing the weird behaviour.

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

    We need to not use Hoverable component on mobile web. The Hover functionality should be used on desktop web only. It can be removed by simply adding a Browser.isMobile condition here that sets / unsets the clone options if the browser is of mobile.

    Doing so will also fix the issue that @michaelhaxhiu found here.

    What alternative solutions did you explore? (Optional)

    Instead of removing the whole clone option, we can also remove onMouseEnter and onMouseLeave options and replace them with onTouchStart and onTouchEnd events.

  5. bernhardoj commented on Jul 20, 2023

    @bernhardoj
    Contributor

    These events are supported on web but not on mobile browsers

    This is false, onMouseEnter and onMouseLeave is supported on mobile web. We have a PR that will completely disable hover on devices without hover support.

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 20, 2023
  7. changed the title [-]mWeb - Long pressing message shows item selected in Menu at the touch point[/-] [+][$1000] mWeb - Long pressing message shows item selected in Menu at the touch point[/+] on Jul 20, 2023
  8. melvin-bot commented on Jul 20, 2023

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jul 20, 2023
  10. melvin-bot commented on Jul 20, 2023

    @melvin-bot

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

  11. melvin-bot commented on Jul 20, 2023

    @melvin-bot

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

  12. proshir commented on Jul 20, 2023

    @proshir

    Proposal

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

    To prevent the long-press menu item from showing a hover effect on touch devices in the React iOS application.

    What is the root cause of that problem?

    The root cause of the issue is the Hoverable component's usage, relying on onMouseEnter and onMouseLeave events, which are supported on web but not on mobile browsers.

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

    We propose implementing a custom long-press handler for touch devices and conditionally using the Hoverable component only for desktop web. Additionally, we introduce a state variable, isTouchDevice, to determine if the device is touch-enabled. The custom event handlers are set accordingly to handle the long-press behavior without triggering the hover effect on the menu items.
    for example:

     useEffect(() => {
        // Check if the device is a touch-enabled device
        setIsTouchDevice('ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0);
      }, []);
      const handleLongPress = () => {
        setMenuOpen(true);
      };
      const handleMenuItemSelect = (menuItem) => {
        console.log('Selected menu item:', menuItem);
        setMenuOpen(false);
      };
      const eventHandlers = isTouchDevice
        ? { onTouchStart: handleLongPress }
        : { onMouseEnter: () => setMenuOpen(true), onMouseLeave: () => setMenuOpen(false) };
         <div {...eventHandlers}>
    ...
          {isMenuOpen && (
            <div className="menu">
              <div className="menuItem" onClick={() => handleMenuItemSelect(...)}>
                ...
              </div>
              ....
    

    What alternative solutions did you explore? (Optional)

    We considered removing the Hoverable component on mobile web based on the client's suggestion, but the client did not accept this approach. We also explored replacing onMouseEnter and onMouseLeave with onTouchStart and onTouchEnd events, but the client indicated that onMouseEnter and onMouseLeave are supported on mobile web and that they have a PR to handle hover on devices without hover support. As a result, we believe the proposed solution provides the best compromise between touch and desktop web interactions, allowing the menu to open without triggering the hover effect on both touch and desktop devices.

  13. 7 remaining items

  14. melvin-bot commented on Jul 27, 2023

    @melvin-bot

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

  15. mollfpr commented on Jul 31, 2023

    @mollfpr
    Contributor

    I can't reproduce it on the latest DEV.

    mWeb/Safari
    Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-07-31.at.17.52.39.mp4
    mWeb/Chrome
    untitled.webm
  16. melvin-bot commented on Aug 2, 2023

    @melvin-bot

    @mollfpr @lschurr 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!

  17. lschurr commented on Aug 2, 2023

    @lschurr
    Contributor

    Sounds like this one can be closed - I believe we need to pay @DinalJivani for reporting.

  18. lschurr commented on Aug 2, 2023

    @lschurr
    Contributor

    @DinalJivani could you apply to the job here so that we can pay the reporting bonus of $250? https://www.upwork.com/jobs/~011ecfe619c9cb6746

  19. melvin-bot commented on Aug 3, 2023

    @melvin-bot

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

  20. lschurr commented on Aug 7, 2023

    @lschurr
    Contributor

    Bumped @DinalJivani in Slack.

  21. lschurr commented on Aug 7, 2023

    @lschurr
    Contributor

    Payment summary:

    All set. Closing.

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions