Skip to content

Commit faba606

Browse files
committed
bind to objects in search script more consistently [skip ci]
1 parent 2b08106 commit faba606

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/js/vendor/docsearch.bundle.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
autocomplete.setVal() // clear value on page reload
4141
input.on('autocomplete:closed', clearSearch.bind(autocomplete))
4242
input.on('autocomplete:selected', disableClose)
43-
input.on('autocomplete:updated', resetScroll.bind(autocomplete.getWrapper().firstChild))
43+
input.on('autocomplete:updated', resetScroll.bind(typeahead))
4444
dropdown._ensureVisible = ensureVisible
4545
menu.off('mousedown.aa')
4646
var suggestionSelector = '.' + dropdown.cssClasses.prefix + dropdown.cssClasses.suggestion
@@ -51,7 +51,7 @@
5151
monitorCtrlKey(input, dropdown)
5252
searchField.addEventListener('click', confineEvent)
5353
document.documentElement.addEventListener('click', clearSearch.bind(autocomplete))
54-
document.addEventListener('keydown', handleShortcuts.bind(input))
54+
document.addEventListener('keydown', handleShortcuts.bind(typeahead))
5555
if (input.attr('autofocus') != null) input.focus()
5656
}
5757

@@ -60,7 +60,7 @@
6060
}
6161

6262
function resetScroll () {
63-
this.scrollTop = 0
63+
this.dropdown.datasets[0].$el.scrollTop(0)
6464
}
6565

6666
function toggleFilter () {
@@ -99,7 +99,7 @@
9999
var target = e.target || {}
100100
if (e.altKey || e.shiftKey || target.isContentEditable || 'disabled' in target) return
101101
if (e.ctrlKey ? e.keyCode === SOLIDUS_KEY : e.keyCode === S_KEY) {
102-
this.focus()
102+
this.$input.focus()
103103
e.preventDefault()
104104
e.stopPropagation()
105105
}

0 commit comments

Comments
 (0)