From 8a894958718cf40ca1ea7fb71e8304b04f71056c Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Fri, 25 Jun 2021 11:49:54 -0400 Subject: [PATCH] Prevent default for links to avoid double click events --- packages/menu-button/src/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/menu-button/src/index.tsx b/packages/menu-button/src/index.tsx index a18f08f43..151b5cd67 100644 --- a/packages/menu-button/src/index.tsx +++ b/packages/menu-button/src/index.tsx @@ -662,10 +662,10 @@ const MenuItems = React.forwardRef(function MenuItems( // consistent behavior across menu items we'll trigger a click when // the spacebar is pressed. if (selected) { + event.preventDefault(); if (selected.isLink && selected.element) { selected.element.click(); } else { - event.preventDefault(); // Focus the button first by default when an item is selected. // We fire the onSelect callback next so the app can manage // focus if needed.