FIX Prevent defocus on first change in CMS HTMLEditorField (fixes #8217)

Regression caused by https://github.com/silverstripe/silverstripe-cms/commit/26cc14a9
This commit is contained in:
Ingo Schommer 2013-01-30 12:40:52 +01:00
parent c72ba4ecfb
commit eb7fed9ab5
1 changed files with 4 additions and 1 deletions

View File

@ -108,7 +108,10 @@
// 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();
// Skip if an element in the form is already focused.
if(!this.find(document.activeElement).length) {
this.find(':input:not(:submit)[data-skip-autofocus!="true"]').filter(':visible:first').focus();
}
},
onunmatch: function() {
this._super();