Skip to content

Commit

Permalink
Merge pull request #25900 from joh42/fix/25550
Browse files Browse the repository at this point in the history
Fixed composer not catching paste events when unfocused
  • Loading branch information
tgolen authored Aug 25, 2023
2 parents f48a208 + 8f21322 commit 5fd988c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/Composer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,14 @@ function Composer({
}

if (textInput.current !== event.target) {
return;
// To make sure the composer does not capture paste events from other inputs, we check where the event originated
// If it did originate in another input, we return early to prevent the composer from handling the paste
const isTargetInput = event.target.nodeName === 'INPUT' || event.target.nodeName === 'TEXTAREA' || event.target.contentEditable === 'true';
if (isTargetInput) {
return;
}

textInput.current.focus();
}

event.preventDefault();
Expand Down

0 comments on commit 5fd988c

Please sign in to comment.