Stop propagation of keyDown
in <StopPropagation>
See [#5611][0]. [0]: https://github.com/signalapp/Signal-Desktop/pull/5611.
This commit is contained in:
parent
8670a4d864
commit
8477841fd6
1 changed files with 6 additions and 2 deletions
|
@ -4,7 +4,7 @@
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
// Whenever you don't want click events to propagate into their parent container
|
// Whenever you don't want click or key events to propagate into their parent container
|
||||||
export const StopPropagation = ({
|
export const StopPropagation = ({
|
||||||
children,
|
children,
|
||||||
className,
|
className,
|
||||||
|
@ -14,7 +14,11 @@ export const StopPropagation = ({
|
||||||
}): JSX.Element => (
|
}): JSX.Element => (
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
// eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
|
||||||
<div className={className} onClick={ev => ev.stopPropagation()}>
|
<div
|
||||||
|
className={className}
|
||||||
|
onClick={ev => ev.stopPropagation()}
|
||||||
|
onKeyDown={ev => ev.stopPropagation()}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue