Permalink
Browse files

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

  • Loading branch information...
1 parent c72ba4e commit eb7fed9ab5d78b5da6d568f0db3396c34ae8cc57 @chillu chillu committed Jan 30, 2013
Showing with 4 additions and 1 deletion.
  1. +4 −1 admin/javascript/LeftAndMain.EditForm.js
@@ -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();

0 comments on commit eb7fed9

Please sign in to comment.