Fix click propagating from reaction viewer to container
This commit is contained in:
parent
54e7cd21fc
commit
9a9fc60103
2 changed files with 62 additions and 42 deletions
15
ts/components/StopPropagation.tsx
Normal file
15
ts/components/StopPropagation.tsx
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import React, { ReactNode } from 'react';
|
||||
|
||||
// Whenever you don't want click events to propagate into their parent container
|
||||
export const StopPropagation = ({
|
||||
children,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}): JSX.Element => (
|
||||
// eslint-disable-next-line max-len
|
||||
// eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
|
||||
<div onClick={ev => ev.stopPropagation()}>{children}</div>
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue