mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-24 16:54:40 +00:00
25 lines
528 B
TypeScript
25 lines
528 B
TypeScript
|
|
import React from 'react';
|
||
|
|
|
||
|
|
interface Props {
|
||
|
|
children: React.ReactNode;
|
||
|
|
}
|
||
|
|
|
||
|
|
const StopPropagationWrapper = ({ children }: Props) => {
|
||
|
|
return (
|
||
|
|
<span
|
||
|
|
onClick={(e) => e.stopPropagation()}
|
||
|
|
role="button"
|
||
|
|
tabIndex={0}
|
||
|
|
onKeyDown={(e) => {
|
||
|
|
if (e.key === 'Enter' || e.key === ' ') {
|
||
|
|
e.stopPropagation();
|
||
|
|
}
|
||
|
|
}}
|
||
|
|
>
|
||
|
|
{children}
|
||
|
|
</span>
|
||
|
|
);
|
||
|
|
};
|
||
|
|
|
||
|
|
export default StopPropagationWrapper;
|