I鈥檓 thinking of implementing a new feature for Thumb-Key: richer haptic feedback that will make it easier for users to blind-type.
While reviewing the current places where Thumb-Key already performs haptic feedback, I noticed something strange.
When doing a long-press gesture, there are two moments of haptic feedback. First is when the finger initially touches the keyboard key, and second when enough time has passed for the press gestured to be registered as a long press. The second haptic feedback is noticeably stronger than the first.
However, as far as I can tell, both events call the exact same function with the same parameter for both events:
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP)
So how come the second feedback is stronger than the first?
Here is the code for initial press.
And here is the code for the long press.
Just off the top of my head without having tested it: could it be that the initial feedback feels weaker because the contact between thumb and device is not as strong as when it rests on the screen?
I thought of that. To test it, I placed a finger from my left hand at the BACK of the phone first, and then did a long-press with a finger from my right hand.
The second haptic event feels stronger from the left hand鈥檚 finger too.
I figured out the source. The
Modifier.combinedClickableis used to define the click behavior for the key, and by default it has the parameterhapticFeedbackEnabled = truedefined, which automatically causes a vibration for long press.The solution is to simply to specify
hapticFeedbackEnabled = false.Gonna do that and enter a PR.
Nice, that鈥檚 easy enough. I鈥檒l get to your PR soon.