diff --git a/src/inputs/ChipTextField.tsx b/src/inputs/ChipTextField.tsx index 18bf02127..c866642d2 100644 --- a/src/inputs/ChipTextField.tsx +++ b/src/inputs/ChipTextField.tsx @@ -80,9 +80,11 @@ export function ChipTextField(props: ChipTextFieldProps) { } }} onInput={(e: KeyboardEvent) => { - // Prevent user from pasting content that has new line characters and replace with empty space. const target = e.target as HTMLElement; - target.textContent = target.textContent?.replace(/[\n\r]/g, " ") ?? ""; + if ("inputType" in e.nativeEvent && e.nativeEvent.inputType === "insertFromPaste") { + // Clean up any formatting from pasted text + target.innerHTML = target.textContent?.replace(/[A\n\r]/g, " ") ?? ""; + } onChange(target.textContent ?? ""); }} {...focusProps}