Set focus properly in confirmation dialogs when in mouse mode

This commit is contained in:
Scott Nonnenberg 2019-12-13 13:19:07 -08:00
parent 526f12bb45
commit 5f58be1a29
4 changed files with 11 additions and 10 deletions

View file

@ -70,7 +70,9 @@
} }
}, },
focusCancel() { 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);
}, },
}); });
})(); })();

View file

@ -1850,9 +1850,7 @@
const contact = ConversationController.get(contactId); const contact = ConversationController.get(contactId);
const message = this.model.messageCollection.get(messageId); const message = this.model.messageCollection.get(messageId);
if (!message) { if (!message) {
throw new Error( throw new Error(`forceSend: Did not find message for id ${messageId}`);
`deleteMessage: Did not find message for id ${messageId}`
);
} }
const dialog = new Whisper.ConfirmationDialogView({ const dialog = new Whisper.ConfirmationDialogView({

View file

@ -60,6 +60,7 @@
reject, reject,
}); });
this.$el.append(dialog.el); this.$el.append(dialog.el);
dialog.focusCancel();
}); });
}, },
}, },

View file

@ -335,10 +335,10 @@
{ {
"rule": "jQuery-$(", "rule": "jQuery-$(",
"path": "js/views/confirmation_dialog_view.js", "path": "js/views/confirmation_dialog_view.js",
"line": " this.$('.cancel').focus();", "line": " setTimeout(() => this.$('.cancel').focus(), 1);",
"lineNumber": 73, "lineNumber": 75,
"reasonCategory": "usageTrusted", "reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z", "updated": "2019-12-07T02:04:56.987Z",
"reasonDetail": "Protected from arbitrary input" "reasonDetail": "Protected from arbitrary input"
}, },
{ {
@ -1170,7 +1170,7 @@
"rule": "jQuery-$(", "rule": "jQuery-$(",
"path": "js/views/whisper_view.js", "path": "js/views/whisper_view.js",
"line": " $('script[type=\"text/x-tmpl-mustache\"]').each((i, el) => {", "line": " $('script[type=\"text/x-tmpl-mustache\"]').each((i, el) => {",
"lineNumber": 70, "lineNumber": 71,
"reasonCategory": "usageTrusted", "reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z", "updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input" "reasonDetail": "Protected from arbitrary input"
@ -1179,7 +1179,7 @@
"rule": "jQuery-$(", "rule": "jQuery-$(",
"path": "js/views/whisper_view.js", "path": "js/views/whisper_view.js",
"line": " const $el = $(el);", "line": " const $el = $(el);",
"lineNumber": 71, "lineNumber": 72,
"reasonCategory": "usageTrusted", "reasonCategory": "usageTrusted",
"updated": "2018-09-19T21:59:32.770Z", "updated": "2018-09-19T21:59:32.770Z",
"reasonDetail": "Protected from arbitrary input" "reasonDetail": "Protected from arbitrary input"
@ -1188,7 +1188,7 @@
"rule": "jQuery-html(", "rule": "jQuery-html(",
"path": "js/views/whisper_view.js", "path": "js/views/whisper_view.js",
"line": " templates[id] = $el.html();", "line": " templates[id] = $el.html();",
"lineNumber": 73, "lineNumber": 74,
"reasonCategory": "usageTrusted", "reasonCategory": "usageTrusted",
"updated": "2018-09-15T00:38:04.183Z", "updated": "2018-09-15T00:38:04.183Z",
"reasonDetail": "Getting the value, not setting it" "reasonDetail": "Getting the value, not setting it"