summaryrefslogtreecommitdiffstats
path: root/webapp/components/leave_team_modal.jsx
diff options
context:
space:
mode:
authorRyan Wang <R-Wang97@users.noreply.github.com>2017-05-15 10:08:25 -0400
committerJoram Wilander <jwawilander@gmail.com>2017-05-15 10:08:25 -0400
commit375cdbdb13d73abbab185980c3047c781e830df9 (patch)
treeed5a4a7974e7ae903e32384fef6fec89baaeb426 /webapp/components/leave_team_modal.jsx
parent1397798f1763b0848957a8672c8d40b6243764d5 (diff)
downloadchat-375cdbdb13d73abbab185980c3047c781e830df9.tar.gz
chat-375cdbdb13d73abbab185980c3047c781e830df9.tar.bz2
chat-375cdbdb13d73abbab185980c3047c781e830df9.zip
Pressing Enter submits Leave Team Modal (#6096)
Diffstat (limited to 'webapp/components/leave_team_modal.jsx')
-rw-r--r--webapp/components/leave_team_modal.jsx9
1 files changed, 9 insertions, 0 deletions
diff --git a/webapp/components/leave_team_modal.jsx b/webapp/components/leave_team_modal.jsx
index 4728fb16d..379ece4c3 100644
--- a/webapp/components/leave_team_modal.jsx
+++ b/webapp/components/leave_team_modal.jsx
@@ -20,6 +20,7 @@ class LeaveTeamModal extends React.Component {
this.handleToggle = this.handleToggle.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
this.handleHide = this.handleHide.bind(this);
+ this.handleKeyPress = this.handleKeyPress.bind(this);
this.state = {
show: false
@@ -28,10 +29,18 @@ class LeaveTeamModal extends React.Component {
componentDidMount() {
ModalStore.addModalListener(ActionTypes.TOGGLE_LEAVE_TEAM_MODAL, this.handleToggle);
+ document.addEventListener('keypress', this.handleKeyPress);
}
componentWillUnmount() {
ModalStore.removeModalListener(ActionTypes.TOGGLE_LEAVE_TEAM_MODAL, this.handleToggle);
+ document.removeEventListener('keypress', this.handleKeyPress);
+ }
+
+ handleKeyPress(e) {
+ if (e.key === 'Enter' && this.state.show) {
+ this.handleSubmit(e);
+ }
}
handleToggle(value) {