Skip to content

Commit

Permalink
Merge pull request #8064 from mollfpr/fix/send-button-active
Browse files Browse the repository at this point in the history
Send button is active when message has spaces, but does not send it
  • Loading branch information
NikkiWines authored Mar 10, 2022
2 parents f0a4118 + 26830e8 commit e3b47eb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class ReportActionCompose extends React.Component {

this.focus(false);
});
this.updateComment(this.comment);
}

componentDidUpdate(prevProps) {
Expand Down Expand Up @@ -307,7 +308,7 @@ class ReportActionCompose extends React.Component {
updateComment(newComment) {
this.textInput.setNativeProps({text: newComment});
this.setState({
isCommentEmpty: newComment.length === 0,
isCommentEmpty: newComment.trim().length === 0,
});

// Indicate that draft has been created.
Expand Down Expand Up @@ -345,8 +346,8 @@ class ReportActionCompose extends React.Component {
this.submitForm();
}

// Trigger the edit box for last sent message if ArrowUp is pressed
if (e.key === 'ArrowUp' && this.state.isCommentEmpty) {
// Trigger the edit box for last sent message if ArrowUp is pressed and the comment is empty
if (e.key === 'ArrowUp' && this.textInput.selectionStart === 0 && this.state.isCommentEmpty) {
e.preventDefault();

const reportActionKey = _.find(
Expand Down

0 comments on commit e3b47eb

Please sign in to comment.