react-spectrum
react-spectrum copied to clipboard
Handle dragging with NVDA/JAWS in browse mode
Related to #3221
After https://github.com/adobe/react-spectrum/pull/3421, it isn't possible to trigger drag and drop while in browse mode in NVDA/JAWS. This is the default when navigating to button elements, like in the default dnd story. In browse mode, only an onClick event is fired. Keyboard events are not fired.
Solution is to add an onClick handler that only applies if a virtual click is detected. This means that there can be no other click events on the element, because we cannot distinguish Enter from Space. For standalone draggable elements I think this is probably ok. For elements within collections, where we might have selection, we remove the onClick handler, which is ok because NVDA/JAWS are always in forms mode within collections.
This also centralizes the isVirtualClick and isVirtualPointerEvent functions into @react-aria/utils, and fixes dropping on button drop targets in browse mode.
Build successful! 🎉
Build successful! 🎉
Build successful! 🎉
Build successful! 🎉
Build successful! 🎉
Build successful! 🎉
Build successful! 🎉
Build successful! 🎉
This is weird because that line was really meant for Android Talkback but ok...
Build successful! 🎉
Build successful! 🎉
Build successful! 🎉