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() {
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 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({

View File

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

View File

@ -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"