launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #02576
[Merge] lp:~huwshimi/lazr-js/autocomplete-enter-580404 into lp:lazr-js
Huw Wilkins has proposed merging lp:~huwshimi/lazr-js/autocomplete-enter-580404 into lp:lazr-js.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
#580404 pressing enter in tags field doesn't save them
https://bugs.launchpad.net/bugs/580404
For more details, see:
https://code.launchpad.net/~huwshimi/lazr-js/autocomplete-enter-580404/+merge/49351
Pressing enter in an autocomplete field now submits the form when there are no suggestions.
TO TEST:
View a bug page. Click the edit button or "Add tags". Type in a tag name. Press ENTER.
The form should submit and the tags will be saved. You used to have to press ENTER twice to get this to happen.
--
https://code.launchpad.net/~huwshimi/lazr-js/autocomplete-enter-580404/+merge/49351
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~huwshimi/lazr-js/autocomplete-enter-580404 into lp:lazr-js.
=== modified file 'src-js/lazrjs/autocomplete/autocomplete.js'
--- src-js/lazrjs/autocomplete/autocomplete.js 2011-01-14 14:52:37 +0000
+++ src-js/lazrjs/autocomplete/autocomplete.js 2011-02-11 06:03:58 +0000
@@ -723,7 +723,10 @@
_onInputKeydown: function(e) {
// Is this one of our completion keys; Tab, or Enter?
if (e.keyCode === TAB || e.keyCode === RETURN) {
- if (this.get(QUERY) !== null && !this._last_input_was_completed) {
+ /* Check that the last string completed and are there matching
+ queries (we don't wat to try and complete the input if there are
+ no matches). */
+ if (!this._last_input_was_completed && this.findMatches(this.get(QUERY).text).length !== 0) {
// The user has an active query in the input box.
this.completeInput();
// Keep the tab key from switching focus away from the input
Follow ups