Scenario:
Bind to the 'keydown' on the textarea, and when the Enter key is pressed, submit the textarea value.
Issue:
If you register your event listener first, the value is sent without the mention in place.
If you register it after initing mentions, enter will submit the value when the user intended to simply select the first mention.
Solution:
When the mentions list is open, and the user presses Enter, the list is closed, and thus should stop propagation. Otherwise, any subsequent listener for the 'Enter' keypress cannot tell if it was triggered by selecting the first mention, or genuinely pressing enter to send the message.
Scenario: Bind to the 'keydown' on the textarea, and when the
Enter
key is pressed, submit the textarea value.Issue:
Solution: When the mentions list is open, and the user presses Enter, the list is closed, and thus should stop propagation. Otherwise, any subsequent listener for the 'Enter' keypress cannot tell if it was triggered by selecting the first mention, or genuinely pressing enter to send the message.