diff --git a/js/views/confirmation_dialog_view.js b/js/views/confirmation_dialog_view.js index e81b6079b..02867fe77 100644 --- a/js/views/confirmation_dialog_view.js +++ b/js/views/confirmation_dialog_view.js @@ -70,7 +70,9 @@ } }, focusCancel() { - this.$('.cancel').focus(); + // We delay this call because we might be called inside click handlers + // which would set focus to themselves afterwards! + setTimeout(() => this.$('.cancel').focus(), 1); }, }); })(); diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index 99590ab97..f5c1eea5f 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -1850,9 +1850,7 @@ const contact = ConversationController.get(contactId); const message = this.model.messageCollection.get(messageId); if (!message) { - throw new Error( - `deleteMessage: Did not find message for id ${messageId}` - ); + throw new Error(`forceSend: Did not find message for id ${messageId}`); } const dialog = new Whisper.ConfirmationDialogView({ diff --git a/js/views/whisper_view.js b/js/views/whisper_view.js index 4ac7c6f7e..1ac49f2b1 100644 --- a/js/views/whisper_view.js +++ b/js/views/whisper_view.js @@ -60,6 +60,7 @@ reject, }); this.$el.append(dialog.el); + dialog.focusCancel(); }); }, }, diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index b015bf161..47e50df22 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -335,10 +335,10 @@ { "rule": "jQuery-$(", "path": "js/views/confirmation_dialog_view.js", - "line": " this.$('.cancel').focus();", - "lineNumber": 73, + "line": " setTimeout(() => this.$('.cancel').focus(), 1);", + "lineNumber": 75, "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", + "updated": "2019-12-07T02:04:56.987Z", "reasonDetail": "Protected from arbitrary input" }, { @@ -1170,7 +1170,7 @@ "rule": "jQuery-$(", "path": "js/views/whisper_view.js", "line": " $('script[type=\"text/x-tmpl-mustache\"]').each((i, el) => {", - "lineNumber": 70, + "lineNumber": 71, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1179,7 +1179,7 @@ "rule": "jQuery-$(", "path": "js/views/whisper_view.js", "line": " const $el = $(el);", - "lineNumber": 71, + "lineNumber": 72, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1188,7 +1188,7 @@ "rule": "jQuery-html(", "path": "js/views/whisper_view.js", "line": " templates[id] = $el.html();", - "lineNumber": 73, + "lineNumber": 74, "reasonCategory": "usageTrusted", "updated": "2018-09-15T00:38:04.183Z", "reasonDetail": "Getting the value, not setting it"