~sidnei/lazr-js/dont-replace-data-uri

« back to all changes in this revision

Viewing changes to src-js/lazrjs/autocomplete/autocomplete.js

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-03-01 06:14:16 UTC
  • mfrom: (202.2.3 autocomplete-enter-580404)
  • Revision ID: launchpad@pqm.canonical.com-20110301061416-6xv9qknhtb23zfd1
[r=huwshimi] Pressing enter in an autocomplete field now submits the
        form when there are no suggestions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
723
723
    _onInputKeydown: function(e) {
724
724
        // Is this one of our completion keys; Tab, or Enter?
725
725
        if (e.keyCode === TAB || e.keyCode === RETURN) {
726
 
            if (this.get(QUERY) !== null && !this._last_input_was_completed) {
 
726
            /* Check that the last string was not completed and that there are  
 
727
               matching queries (we don't want to try and complete the input if 
 
728
               there are no matches). */
 
729
            if (this.get(QUERY) !== null && !this._last_input_was_completed && this.findMatches(this.get(QUERY).text).length !== 0) {
727
730
                // The user has an active query in the input box.
728
731
                this.completeInput();
729
732
                // Keep the tab key from switching focus away from the input