Skip to content

Commit

Permalink
fix: FavoriteIcon not stopping propagation
Browse files Browse the repository at this point in the history
When clicking the FavoriteIcon inside an element with onClick, the
onClick of the other element is triggered after the onChange of the
FavoriteIcon.

Added stopPropagation to prevent event propagation.
  • Loading branch information
Gido Manders committed Dec 11, 2024
1 parent 798ed36 commit c1a5a3d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/core/FavoriteIcon/FavoriteIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export function FavoriteIcon({
}: FavoriteIconProps) {
function onClick(e: React.MouseEvent<HTMLElement>) {
e.preventDefault();
e.stopPropagation();
onChange(!value);
}

Expand Down

0 comments on commit c1a5a3d

Please sign in to comment.