Skip to content

Commit

Permalink
Merge pull request #10 from rhysd/fix-up-down
Browse files Browse the repository at this point in the history
候補を矢印キーで選択した時にページがスクロールしてしまう問題を修正
  • Loading branch information
melpon authored Oct 24, 2017
2 parents 443fe37 + 5269dba commit 7f9fc3f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/js/crsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,14 @@ export default class CRSearch {

let box = $(sel)
box.attr('data-crsearch-id', id)
Mousetrap.bind('up', this.selectChange.bind(this, true, box))
Mousetrap.bind('down', this.selectChange.bind(this, false, box))
Mousetrap.bind('up', e => {
e.preventDefault()
this.selectChange(true, box)
})
Mousetrap.bind('down', e => {
e.preventDefault()
this.selectChange(false, box)
})

this.last_input[id] = ''

Expand Down

0 comments on commit 7f9fc3f

Please sign in to comment.