mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Moving edit form focus logic from onadd() to onmatch() to give the form time to become visible (see #7258)
This commit is contained in:
parent
ecb48bb57c
commit
2fa835a027
@ -68,12 +68,6 @@
|
||||
// in order to avoid changing the menu state if the action is cancelled by the user
|
||||
// $('.cms-menu')
|
||||
|
||||
// focus input on first form element. Exclude elements which
|
||||
// specifically opt-out of this behaviour via "data-skip-autofocus".
|
||||
// This opt-out is useful if the first visible field is shown far down a scrollable area,
|
||||
// for example for the pagination input field after a long GridField listing.
|
||||
this.find(':input:visible:not(:submit)[data-skip-autofocus!="true"]:first').focus();
|
||||
|
||||
// Optionally get the form attributes from embedded fields, see Form->formHtmlContent()
|
||||
for(var overrideAttr in {'action':true,'method':true,'enctype':true,'name':true}) {
|
||||
var el = this.find(':input[name='+ '_form_' + overrideAttr + ']');
|
||||
@ -110,7 +104,18 @@
|
||||
this.changetracker('destroy');
|
||||
this._super();
|
||||
},
|
||||
onmatch: function() {
|
||||
this._super();
|
||||
|
||||
// focus input on first form element. Exclude elements which
|
||||
// specifically opt-out of this behaviour via "data-skip-autofocus".
|
||||
// This opt-out is useful if the first visible field is shown far down a scrollable area,
|
||||
// for example for the pagination input field after a long GridField listing.
|
||||
this.find(':input:not(:submit)[data-skip-autofocus!="true"]').filter(':visible:first').focus();
|
||||
},
|
||||
onunmatch: function() {
|
||||
this._super();
|
||||
},
|
||||
redraw: function() {
|
||||
if(window.debug) console.log('redraw', this.attr('class'), this.get(0));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user