Radium: Handle (hover, active) states for touch devices.

Created on 3 Mar 2015  Â·  12Comments  Â·  Source: FormidableLabs/radium

I noticed that only mouse events are taken into account when computing states. Are there any plans to support touch?

enhancement help wanted plugin

Most helpful comment

We're planning on using generated CSS to handle pseudo-classes instead of emulating them ourselves. That's part of a larger effort to deal with a lot of issues, but it will resolve this one as well. See #788.

All 12 comments

This is a goal, absolutely. I believe @kenwheeler had some ideas about this as well. I'd like to go over our browser state system and do some refactoring soon, so hopefully we can address this use case then.

Is this still relevant? Since we use mouseEnter and mouseDown handlers, won't the browser automatically apply these when touching? Is the goal to support faster touches, such that we don't add those handlers to avoid the delays?

I think there's some benefit in applying styles based on touch events immediately, rather than relying on the simulated :hover and etc events handled by the browser. See discussion in #86.

From #424:

If it detects it is on mobile, Radium should use touchstart and touchend to trigger active states. This would be very easy to add as a plugin. See https://github.com/FormidableLabs/radium/blob/master/src/plugins/resolve-interaction-styles-plugin.js for example.

I am gonna take a stab at it and see if I can get a PR

Sweet, thanks.
On Wed, Jan 13, 2016 at 2:07 PM Sitian Liu [email protected] wrote:

I am gonna take a stab at it and see if I can get a PR

—
Reply to this email directly or view it on GitHub
https://github.com/FormidableLabs/radium/issues/63#issuecomment-171452534
.

Keep in mind that many devices (such as most Chromebooks) support both touch and mouse.

any update on this?

Any updates on this? I've been working with React + Radium in cordova lately and would love to have a way to get the states working without a stylesheet.

Thanks!

We're planning on using generated CSS to handle pseudo-classes instead of emulating them ourselves. That's part of a larger effort to deal with a lot of issues, but it will resolve this one as well. See #788.

Also ran into this. :active state is too slow on mobile. Any updates on this?

Was this page helpful?
0 / 5 - 0 ratings