From 1efc1c0d42f4051d42e360f51c7b94a7debba2e2 Mon Sep 17 00:00:00 2001 From: Matchu Date: Wed, 5 Aug 2020 00:31:28 -0700 Subject: [PATCH] fix item remove button in item search Huh, weird how we seem to need preventDefault for buttons, but stopPropagation for links? idk, in any case, the Remove button was doing that thing where it clicks Remove but also bubbles up to the container and clicks it too :p --- src/app/WardrobePage/Item.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/app/WardrobePage/Item.js b/src/app/WardrobePage/Item.js index 94cd82b..1940be2 100644 --- a/src/app/WardrobePage/Item.js +++ b/src/app/WardrobePage/Item.js @@ -59,7 +59,10 @@ function Item({ item, itemNameId, isWorn, isInOutfit, dispatchToOutfit }) { } label="Support" - onClick={() => setSupportDrawerIsOpen(true)} + onClick={(e) => { + setSupportDrawerIsOpen(true); + e.preventDefault(); + }} /> e.stopPropagation()} /> {isInOutfit && ( } label="Remove" - onClick={() => - dispatchToOutfit({ type: "removeItem", itemId: item.id }) - } + onClick={(e) => { + dispatchToOutfit({ type: "removeItem", itemId: item.id }); + e.preventDefault(); + }} /> )} @@ -233,10 +238,7 @@ function ItemActionButton({ icon, label, href, onClick }) { color="gray.400" href={href} target={href ? "_blank" : null} - onClick={(e) => { - if (onClick) onClick(); - e.stopPropagation(); - }} + onClick={onClick} className={css` opacity: 0; transition: all 0.2s;