Skip to content

Commit

Permalink
Merge pull request #8708 from marmelab/UrlField-stopPropagation
Browse files Browse the repository at this point in the history
Fix `<UrlField>` click is cancelled by `Datagrid`'s row click
  • Loading branch information
djhi authored Mar 6, 2023
2 parents c6591e3 + 7a05322 commit 3d7e384
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/ra-ui-materialui/src/field/UrlField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const UrlField: FC<UrlFieldProps> = memo(props => {
<Link
className={className}
href={value}
onClick={stopPropagation}
variant="body2"
{...sanitizeFieldRestProps(rest)}
>
Expand All @@ -44,3 +45,6 @@ export interface UrlFieldProps
extends PublicFieldProps,
InjectedFieldProps,
AnchorHTMLAttributes<HTMLAnchorElement> {}

// useful to prevent click bubbling in a Datagrid with rowClick
const stopPropagation = e => e.stopPropagation();

0 comments on commit 3d7e384

Please sign in to comment.