Giter VIP home page Giter VIP logo

Comments (4)

younes0 avatar younes0 commented on July 17, 2024 1

@stardust66 thanks for your superb explanations !
Okay I will set touch-action="none" to the LongPress wrapped html element if I encounter problems with Safari < 13

from react-longpressable.

stardust66 avatar stardust66 commented on July 17, 2024

Unfortunately, Safari doesn't support Pointer Events yet. React v16.4.0 release notes say this:

Please note that these events will only work in browsers that support the Pointer Events specification. (At the time of this writing, this includes the latest versions of Chrome, Firefox, Edge, and Internet Explorer.) If your application depends on pointer events, we recommend using a third-party pointer events polyfill. We have opted not to include such a polyfill in React DOM, to avoid an increase in bundle size.

So, you need a polyfill. I believe this is the best one: https://github.com/jquery/PEP.

from react-longpressable.

younes0 avatar younes0 commented on July 17, 2024

what would be the propery way to add this polyfill ?
I'm not sure to understand the touch-action attribute

from react-longpressable.

stardust66 avatar stardust66 commented on July 17, 2024

You'd add it by including the polyfill script tag in your document. As of now, Safari (even iOS Safari) does support Pointer Events so I can't really test the polyfill anywhere. As far as I know, touch-action is meant to be a CSS property in the specs, but the polyfill uses it as an attribute instead. The polyfill README says that you should set the touch-action attribute on elements before they can generate touch events. The easiest is to probably do touch-action="none".

Here is a demo I found explaining what touch-action does. You can see how it works by running the site on a touch device: https://www.chenhuijing.com/touch-action/

Here is an explanation from the polyfill: https://github.com/jquery/PEP#touch-action

Here is its documentation of the CSS property in the specs: https://www.w3.org/TR/pointerevents/#the-touch-action-css-property

Let me know what problems you are running into.

from react-longpressable.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.