Skip to content

Commit

Permalink
fix: clicking scope link does not affect checkbox (#9859)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickoferrall authored Jun 24, 2024
1 parent de659aa commit b79943d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/client/components/ScopingSearchResultItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const ScopingSearchResultItem = (props: Props) => {
const {onCompleted, onError, submitMutation} = useMutationProps()
const disabled = !isSelected && usedServiceTaskIds.size >= Threshold.MAX_POKER_STORIES
const isTemp = isTempId(serviceTaskId)

const onClick = () => {
if (disabled || isTemp) return
submitMutation()
Expand All @@ -85,12 +86,24 @@ const ScopingSearchResultItem = (props: Props) => {
persistQuery?.()
}
}

const handleLinkClick = (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
// don't propagate or the checkbox will be toggled
e.stopPropagation()
}

return (
<Item onClick={onClick}>
<Checkbox active={isSelected || isTemp} disabled={disabled} />
<Issue>
<Title>{summary}</Title>
<StyledLink href={url} rel='noopener noreferrer' target='_blank' title={linkTitle}>
<StyledLink
href={url}
rel='noopener noreferrer'
target='_blank'
title={linkTitle}
onClick={handleLinkClick}
>
{linkText}
{isTemp && <Ellipsis />}
</StyledLink>
Expand Down

0 comments on commit b79943d

Please sign in to comment.