Prevent key propagation in controls panel

This commit is contained in:
Steve Ruiz 2021-06-27 20:53:47 +01:00
parent 6ef197e30a
commit a568de9557

View file

@ -8,6 +8,9 @@ import * as Panel from '../panel'
import Control from './control' import Control from './control'
import { deepCompareArrays } from 'utils' import { deepCompareArrays } from 'utils'
const stopKeyboardPropagation = (e: KeyboardEvent | React.KeyboardEvent) =>
e.stopPropagation()
export default function ControlPanel(): JSX.Element { export default function ControlPanel(): JSX.Element {
const rContainer = useRef<HTMLDivElement>(null) const rContainer = useRef<HTMLDivElement>(null)
const codeControls = useSelector( const codeControls = useSelector(
@ -23,6 +26,8 @@ export default function ControlPanel(): JSX.Element {
ref={rContainer} ref={rContainer}
isOpen={isOpen} isOpen={isOpen}
variant="controls" variant="controls"
onKeyDown={stopKeyboardPropagation}
onKeyUp={stopKeyboardPropagation}
> >
{isOpen ? ( {isOpen ? (
<Panel.Layout> <Panel.Layout>