Unbind keydown listeners when Alert modals are closed. #4869
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
This fixes a bug where attempting to hit enter in any sort of textarea would be ignored if the user had previously encountered an Alert modal while navigating throughout the application.
There are two other places where listeners are set up for the enter key. One is on the login modal and the other is a directive that we use on inputs. Both of those listeners are scoped to specific elements and shouldn't impact the enter key throughout the app. The code changed here binds a listener to the entire document so when you hit an Alert the enter key would previously be foobar until you manually refresh the page. I'm pretty confident this is what's been happening when folks report that they're unable to hit the enter key on certain textareas.
One of the easier ways to reproduce this bug (before the fix) was to create a new personal access token. When you create the token, an Alert modal is shown with a key in it. If you then went to any textarea in the application and attempted to hit enter it would not take you to a new line.
link #4192
ISSUE TYPE
COMPONENT NAME