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

InputNumber: Touch and hold button spin doesn't work on iOS browser #2849

Closed
sleepybjr opened this issue May 5, 2022 · 5 comments · Fixed by #2850
Closed

InputNumber: Touch and hold button spin doesn't work on iOS browser #2849

sleepybjr opened this issue May 5, 2022 · 5 comments · Fixed by #2850
Assignees
Labels
Device: Mobile Issue or pull request is *only* related to Mobile device Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@sleepybjr
Copy link

sleepybjr commented May 5, 2022

Describe the bug

The touch and hold spin doesn't seem to work on iOS. I tried adding similar functions as onMouseDown and onMouseUp to the button's onTouchStart and onTouchEnd but it causes a double-click issue with onMouseDown / onTouchStart.

Reproducer

(https://www.primefaces.org/primereact/inputnumber/)

PrimeReact version

8.0.1

React version

18.x

Language

ES6

Build / Runtime

Next.js

Browser(s)

iOS 15.4

Steps to reproduce the behavior

  1. Go to https://www.primefaces.org/primereact/inputnumber/ using iOS
  2. Touch and hold on a button to increment / decrement.
  3. Notice it does not continuously spin similar to desktop browser.

Expected behavior

Touch and hold on an increment / decrement button should cause the input number to continually increase / decrease.

@sleepybjr sleepybjr added the Type: Bug Issue contains a defect related to a specific component. label May 5, 2022
@melloware
Copy link
Member

@melloware
Copy link
Member

melloware commented May 5, 2022

In your TouchStart or TouchEnd try and call event.preventDefault() that should stop it from going to MouseDown/MouseUp. Can you try it?

@melloware melloware changed the title NumberInput: Touch and hold button spin doesn't work on iOS browser InputNumber: Touch and hold button spin doesn't work on iOS browser May 5, 2022
@melloware melloware added the Device: Mobile Issue or pull request is *only* related to Mobile device label May 5, 2022
melloware added a commit to melloware/primereact that referenced this issue May 5, 2022
@melloware
Copy link
Member

Can you try my PR: #2850 ???? According to the docs the TouchEnd TouchStart with preventDefault should cause it NOT to call the mouse events

@sleepybjr
Copy link
Author

I tried out your PR and it's also being called after TouchEnd, so I think after ClearTimer() on both OnButtonTouchEnd, you can add
event.preventDefault();

And that stopped it for me. Thanks!

melloware added a commit to melloware/primereact that referenced this issue May 5, 2022
@melloware
Copy link
Member

Thanks for testing PR updated!

@melloware melloware added this to the 8.1.0 milestone May 5, 2022
@melloware melloware self-assigned this May 5, 2022
@mertsincan mertsincan modified the milestones: 8.1.0, 8.1 May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Device: Mobile Issue or pull request is *only* related to Mobile device Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants