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

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

Closed
1 of 6 tasks
kbecciv opened this issue Jul 19, 2023 · 19 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@kbecciv
Copy link

kbecciv commented Jul 19, 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 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
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 19, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 19, 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

@allroundexperts
Copy link
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.

@bernhardoj
Copy link
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.

@lschurr lschurr added the External Added to denote the issue can be worked on by a contributor label Jul 20, 2023
@melvin-bot melvin-bot bot 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 Jul 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 20, 2023

Job added to Upwork: https://www.upwork.com/jobs/~011ecfe619c9cb6746

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 20, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 20, 2023

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

@proshir
Copy link

proshir commented Jul 20, 2023

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.

@melvin-bot melvin-bot bot added the Overdue label Jul 21, 2023
@mollfpr
Copy link
Contributor

mollfpr commented Jul 24, 2023

Thanks @bernhardoj

I believe your PR will affect this, and big chance that will resolve this issue. @lschurr Let's hold this until the PR merged and I'll test this issue again.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jul 24, 2023
@lschurr
Copy link
Contributor

lschurr commented Jul 26, 2023

Ah, great. Can you link the PR @mollfpr?

@melvin-bot melvin-bot bot removed the Overdue label Jul 26, 2023
@mollfpr
Copy link
Contributor

mollfpr commented Jul 27, 2023

@lschurr Here they are #22925

It's already in the staging. I'll test this issue if it still occurs.

@melvin-bot
Copy link

melvin-bot bot commented Jul 27, 2023

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

@melvin-bot melvin-bot bot added the Overdue label Jul 31, 2023
@mollfpr
Copy link
Contributor

mollfpr commented Jul 31, 2023

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

@melvin-bot melvin-bot bot removed the Overdue label Jul 31, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 2, 2023

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

@melvin-bot melvin-bot bot added the Overdue label Aug 2, 2023
@lschurr
Copy link
Contributor

lschurr commented Aug 2, 2023

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

@melvin-bot melvin-bot bot removed the Overdue label Aug 2, 2023
@lschurr
Copy link
Contributor

lschurr commented Aug 2, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 3, 2023

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

@melvin-bot melvin-bot bot added the Overdue label Aug 7, 2023
@lschurr
Copy link
Contributor

lschurr commented Aug 7, 2023

Bumped @DinalJivani in Slack.

@melvin-bot melvin-bot bot removed the Overdue label Aug 7, 2023
@lschurr
Copy link
Contributor

lschurr commented Aug 7, 2023

Payment summary:

All set. Closing.

@lschurr lschurr closed this as completed Aug 7, 2023
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 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

6 participants