File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "type" : " patch" ,
3+ "comment" : " Mark `onInvoke` event as handled for enter / space press to prevent duplicate call" ,
4+ "packageName" : " @fluentui-react-native/menu" ,
5+ 6+ "dependentChangeType" : " patch"
7+ }
Original file line number Diff line number Diff line change @@ -38,6 +38,11 @@ export const useMenuItem = (props: MenuItemProps): MenuItemInfo => {
3838 if ( ! disabled && ( ! isArrowKey || isArrowOpen ) ) {
3939 componentRef ?. current ?. blur ( ) ;
4040 onClick ?.( e ) ;
41+
42+ // For RN, ENTER / SPACE keypresses are handled by both the `onKey` event handlers and `onPress` handler. Because we
43+ // pass this callback into both `onKeyDown` and `onPress` props, we need to mark the event as handled for ENTER / SPACE
44+ // key presses so that we don't have duplicate `onClick` calls.
45+ e . preventDefault ( ) ;
4146 }
4247
4348 if ( ! hasSubmenu && ! isArrowKey && ! shouldPersist ) {
You can’t perform that action at this time.
0 commit comments