Selecting an autocomplete choice with 'enter' triggers the first bueditor button
| Project: | BUEditor |
| Version: | 5.x-1.x-dev |
| Component: | User interface |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
On a number of different D5 test sites (laptop, hosted elsewhere, etc), I'm seeing pretty broken interaction between bueditor and autocomplete text fields. Whenever you start typing in any autocomplete text field on a page (e.g. the "Authored by" field on a node edit form) and some choices are available, if you use the arrow keys to select one of the choices and hit 'enter', the first bueditor button on the first text area on the form is automatically triggered. E.g. with the default editor, the popup for "Insert/Edit image" comes up. I tested on both Safari (3.2.3) and FF (3.0.10).
I've tested this on a couple of different sites, and I'm seeing the same results on all of them. The one exception is that on a few of the test sites, in FF, instead of the button getting triggered when you hit enter, you get an alert from the browser:
NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]
However, the bug seems to be unique to D5 -- I tested on D6 and I'm not seeing any broken behavior there. Also note: if you mouse over the choices for the autocomplete and click one, it works as expected. Only using the arrow keys and enter triggers the bug.
Let me know if there's any other information I can provide. It should be easy to reproduce.
Thanks,
-Derek

#1
This was reported and fixed for 6.x unofficially. I probably had forgot to check the issue for 5.x
The code added to 6.x:
//fix enter key triggering button click on autocomplete fields.$('input.form-autocomplete').keydown(function(e) {return e.keyCode != 13});
Thanks for reminding this. I'll backport it soon.
#2
Yay, thanks! I'm happy to test if you upload a patch here.
#3
Here comes the patch that applies the above fix to 5.x.
Rather than being a BUEditor fix, this is a core hack actually. If it does not affect autocomplete functionality(which is the case for 6.x) then i think it could go into core.
#4
That one didn't apply cleanly to the end of the DRUPAL-5 branch. I re-rolled the patch, and tested it. Works like a charm. Thanks!
#5
committed. thanks
#6
Automatically closed -- issue fixed for 2 weeks with no activity.