mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
search: Open typeahead on empty string only if lookup triggered by Tab.
Fixes part of #10026. Adds additional option to typeahead: `tabOpensEmptyTypeahead`(default: false): tabOpensEmptyTypeahead overrides helpOnEmptyStrings. This commit sets helpOnEmptyStrings to false and tabOpensEmptyTypeahead to true. Now typeahead will open on an empty string only if Tab has been pressed.
This commit is contained in:
committed by
Tim Abbott
parent
0e2c509a24
commit
b961093c14
7
static/third/bootstrap/js/bootstrap.js
vendored
7
static/third/bootstrap/js/bootstrap.js
vendored
@@ -1900,10 +1900,10 @@
|
||||
|
||||
, lookup: function (event) {
|
||||
var items
|
||||
var from_tab = (event === 'from_tab')
|
||||
|
||||
this.query = this.$element.is("[contenteditable]") ? this.$element.text() : this.$element.val();
|
||||
|
||||
if (!this.options.helpOnEmptyStrings) {
|
||||
if (!this.options.helpOnEmptyStrings && !(from_tab && this.options.tabOpensEmptyTypeahead)) {
|
||||
if (!this.query || this.query.length < this.options.minLength) {
|
||||
return this.shown ? this.hide() : this
|
||||
}
|
||||
@@ -2070,7 +2070,7 @@
|
||||
|
||||
case 9: // tab
|
||||
if (!this.shown) {
|
||||
this.lookup()
|
||||
this.lookup('from_tab')
|
||||
return
|
||||
}
|
||||
this.select(e)
|
||||
@@ -2143,6 +2143,7 @@
|
||||
, stopAdvance: false
|
||||
, dropup: false
|
||||
, advanceKeyCodes: []
|
||||
, tabOpensEmptyTypeahead: false
|
||||
}
|
||||
|
||||
$.fn.typeahead.Constructor = Typeahead
|
||||
|
||||
Reference in New Issue
Block a user