1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 15:30:58 +01:00

Make Cmd+Enter work to submit a form

Summary:
Fixes T3010.

`keydown` is what you're supposed to use for special keys like `Enter`; `keypress` didn't work for me for Cmd+Enter on Chrome.

Test Plan: Submitted a Differential field with Cmd+Enter on Chrome Mac. Also made sure Ctrl+Enter still works and Opt+Enter does not.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T3010

Differential Revision: https://secure.phabricator.com/D8699
This commit is contained in:
Ben Alpert 2014-04-03 19:00:47 -07:00 committed by epriestley
parent e3b5737d02
commit 077f57f06d

View file

@ -15,9 +15,9 @@ JX.behavior('aphront-form-disable-on-submit', function(config) {
});
JX.Stratcom.listen('keypress', ['tag:form', 'tag:textarea'], function(e) {
JX.Stratcom.listen('keydown', ['tag:form', 'tag:textarea'], function(e) {
var raw = e.getRawEvent();
if (e.getSpecialKey() != 'return' || !raw.ctrlKey) {
if (!(e.getSpecialKey() === 'return' && (raw.ctrlKey || raw.metaKey))) {
return;
}