mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX Choose first "action" button on submission of CMS forms via enter key, to avoid a form field button being autoselected (fixes #7151)
This commit is contained in:
parent
517a0c9e48
commit
85a331cc11
@ -147,6 +147,16 @@
|
||||
return false;
|
||||
},
|
||||
|
||||
onkeydown: function(e) {
|
||||
if(e.which == 13) {
|
||||
// Submit the form with the first action button if enter key is pressed.
|
||||
// Avoids browsers auto-selecting the first button available,
|
||||
// which might be on a form field, e.g. an UploadField popup trigger.
|
||||
var btn = this.find('.Actions .action:first');
|
||||
this.trigger('submit', e, btn);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Function: validate
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user