Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #5557 (closed defect: invalid)

Opened 3 years ago

Last modified 2 years ago

[PATCH] Inplace Editor with remotely loaded text fails in Internet Explorer

Reported by: contact@lukeredpath.co.uk Assigned to: Rails
Priority: high Milestone:
Component: script.aculo.us Version: 1.1.1
Severity: major Keywords: inplaceeditor inplace editor internet explorer ie patch
Cc:

Description

When passing a loadTextURL parameter to the inplace editor, an error occurs in Internet Explorer where it tries to focus the created edit field but the field is disabled by the loadExternalText function whilst it sends the AJAX request to the server for the remote text. This results in the following javascript error in IE:

Can't move focus to the control because it's invisible not enabled or of a type that does not accept focus.

It works ok in Firefox and Safari so one can only assume that these browsers are placing focus on the edit field before the field is disabled by loadExternalText(), whilst IE is trying to place focus on it after the field is disabled.

I have come up with a workaround that instead of simply calling the loadExternalText() function if a loadTextURL parameter is supplied, it instead attaches the loadExternalText() function to the textfield's onfocus event handler. After the AJAX request is made, the textfield's onfocus handler is then set back to null.

if(this.options.loadTextURL) {
  textField.onfocus = this.loadExternalText.bind(this);
}

The full patch is attached. I've made the patch against the latest version in the trunk (4526).

Attachments

scriptaculous_fix_inplaceeditor_with_remote_text_in_ie.diff (0.6 kB) - added by contact@lukeredpath.co.uk on 06/30/06 10:50:21.
Fixe InplaceEditor with remote text in IE
scriptaculous_fix_inplaceeditor_with_remote_text_in_ie_2.diff (0.6 kB) - added by contact@lukeredpath.co.uk on 06/30/06 10:54:00.
Updated patch for the above

Change History

06/30/06 10:50:21 changed by contact@lukeredpath.co.uk

  • attachment scriptaculous_fix_inplaceeditor_with_remote_text_in_ie.diff added.

Fixe InplaceEditor with remote text in IE

06/30/06 10:53:34 changed by contact@lukeredpath.co.uk

Sorry, I just noticed a small bug with the code - it wont work with textarea inplace editors as I've used textField instead of this.editField. Please see the revised patch.

06/30/06 10:54:00 changed by contact@lukeredpath.co.uk

  • attachment scriptaculous_fix_inplaceeditor_with_remote_text_in_ie_2.diff added.

Updated patch for the above

07/02/06 11:08:09 changed by anonymous

  • owner changed from David to Rails.
  • component changed from ActiveRecord to script.aculo.us.

08/02/06 17:15:55 changed by kintner@gmail.com

Applying this patch fixes IE for me but introduces a bug in Firefox where unless the textarea gains focus, looses focus, and gains focus again the caret is not displayed in the textarea.

By adding this.editField.blur(); after this.editField.onfocus = null; seems to fix the bug for me but I am not sure this is the best way to fix it.

10/24/07 21:20:56 changed by mislav

  • status changed from new to closed.
  • resolution set to invalid.

IPE has been completely rewritten since this ticket was updated. Try and see if the problem persists and update the patch if it does.