software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
6.13k stars 982 forks source link

[`web`] Add keyboard support to gesture handler #3035

Closed latekvo closed 3 months ago

latekvo commented 3 months ago

Description

By default, all native android and web components support keyboard navigation and option to press elements with Enter or Spacebar keys.

Gestures and components provided by Gesture Handler lack the latter option.

This PR adds keyboard support to the entirety of gesture handler, allowing it to replace mouse or finger navigation.

Test plan

Gallery

Expand https://github.com/user-attachments/assets/3523142a-c786-4dc2-aa84-f49d96d03ecd https://github.com/user-attachments/assets/488c7716-91ed-42aa-8a6c-49a90db5002a
latekvo commented 3 months ago

As of 5564563, it looks like Keyboard is fully functional on web - this includes both Gesture Handler and all related components like Pressable

latekvo commented 3 months ago

by pressing

element states gets stuck on down position. I'll have to add pointerCancelCallback before pushing.