zulip/zulip-mobile

Haptic feedback on long press

Open

#4,649 opened on Apr 12, 2021

View on GitHub
 (0 comments) (0 reactions) (0 assignees)JavaScript (673 forks)github user discovery
help wanted

Repository metrics

Stars
 (1,348 stars)
PR merge metrics
 (PR metrics pending)

Description

When the user does a long-press, we should respond with haptic feedback. This is standard on both platforms. Here's an explanation of why it's needed: https://developer.apple.com/design/human-interface-guidelines/ios/user-interaction/haptics/ In particular I think our lack of it is contributing to our long-press responses feeling slow, even though we're responding at the same 500ms threshold as is standard on both platforms. Chat discussion: https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/long.20press/near/1160638

There's basically four environments for this, some of which we might be able to cover at once and some of which might be independent tasks:

  • Inside the WebView, on iOS. This one seems to already work (see chat discussion) on iOS 13+. No action needed, but if we hear of it not working on iOS 13+ then we'll investigate.
  • Inside the WebView, on Android.
  • In the pure-RN views (so e.g. long-pressing a topic in the unreads list or in the app bar), on iOS.
  • In the pure-RN views (so e.g. long-pressing a topic in the unreads list or in the app bar), on Android.

On Android there's a specific haptic response that is standard for long-press, and we should be sure to use that. On iOS I'm not sure there's a single standard, but we should use something similar to other iOS apps, as standard as possible -- which empirically means it'll be pretty different from the Android standard. Ideally we can get both at once by using some library made for RN.

@chrisbobbe adds some notes on implementation approaches:

I'm not sure what RN v0.63's new Pressable API (release notes) does by default, but we could try using that more than we do. Possibly it just makes it easier to manage state such that haptic feedback is given, without actually giving haptic feedback by default.

If it seems useful we could look at Expo's Haptics library.

Contributor guide