Code Monkey home page Code Monkey logo

Comments (2)

snowystinger avatar snowystinger commented on September 21, 2024

Are those actually long presses? I tried Stories with touch, and it pauses until the press is ended. But long press finishes after about half a second, which would be a different behavior. If you used useLongPress for this, it'd only pause the video for half a second and then it would resume. Seems like useLongPress isn't the right thing to use for this interaction pattern to begin with?

It also doesn't take a long press for the keyboard version of the interaction, just a quick tap of the 'Space' key will pause a video.

Maybe you can provide more details about what you're building, or an example app? Maybe some interaction patterns are being conflated. For instance, I think you can just use usePress with onPressStart and onPressEnd and use the interaction mode to determine what actions to take.

Something along these lines?
Touch: pause on press start, resume on press end
Mouse: toggle pause on press
Keyboard: toggle pause on press

from react-spectrum.

devongovett avatar devongovett commented on September 21, 2024

We did not include keyboard interactions in useLongPress by default because they often differ between components. For example, in a button with both normal and long press mouse/touch interactions, you might use Alt + Enter or Alt + ArrowDown to open a long press menu. We could potentially make it configurable, but it doesn't seem too hard to use useLongPress in combination with your own onKeyDown listener either.

from react-spectrum.

Related Issues (20)

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.