diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx index 0088081ae..f6d7b2e46 100644 --- a/src/frontend/src/App.tsx +++ b/src/frontend/src/App.tsx @@ -121,6 +121,20 @@ export default function App() { ); }; + const handleKeyPress = (e: KeyboardEvent) => { + if (e.ctrlKey && e.key === "Backspace") { + e.preventDefault(); + e.stopPropagation(); + } + }; + + useEffect(() => { + document.addEventListener('keydown', handleKeyPress); + return () => { + document.removeEventListener('keydown', handleKeyPress); + }; + }, []); + return ( //need parent component with width and height
diff --git a/src/frontend/src/components/AccordionComponent/index.tsx b/src/frontend/src/components/AccordionComponent/index.tsx index 7212e6a1b..29405171b 100644 --- a/src/frontend/src/components/AccordionComponent/index.tsx +++ b/src/frontend/src/components/AccordionComponent/index.tsx @@ -32,6 +32,13 @@ export default function AccordionComponent({ value === "" ? setValue(keyValue) : setValue(""); } + const handleKeyDown = (event) => { + if (event.key === "Backspace") { + event.preventDefault(); + event.stopPropagation(); + } + }; + return ( <> { onChange(e.target.value); }} + onKeyDown={(e) => { + handleKeyDown(e, value, '0'); + }} />
); diff --git a/src/frontend/src/components/inputComponent/index.tsx b/src/frontend/src/components/inputComponent/index.tsx index 78b06c411..bad1d68b3 100644 --- a/src/frontend/src/components/inputComponent/index.tsx +++ b/src/frontend/src/components/inputComponent/index.tsx @@ -2,6 +2,7 @@ import { useEffect, useState } from "react"; import { InputComponentType } from "../../types/components"; import { classNames } from "../../utils/utils"; import { Input } from "../ui/input"; +import { handleKeyDown } from "../../utils/reactflowUtils"; export default function InputComponent({ value, @@ -19,6 +20,7 @@ export default function InputComponent({ } }, [disabled, onChange]); + return (
{ onChange(e.target.value); }} + onKeyDown={(e) => { + handleKeyDown(e, value, ''); + }} /> {password && (