From 38eb33bd42d15d589c4aba46919f5cb97a7b59b8 Mon Sep 17 00:00:00 2001 From: Cade Scroggins Date: Wed, 5 Apr 2017 23:24:50 -0700 Subject: [PATCH] bind to arrow keys for suggestion navigation --- index.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index bdc0050..a85119d 100644 --- a/index.html +++ b/index.html @@ -499,11 +499,13 @@ } _handleKeydown(event) { + const isDown = event.which === 40; + const isUp = event.which === 38; const isCtrlN = event.which === 78 && event.ctrlKey; const isCtrlP = event.which === 80 && event.ctrlKey; - if (isCtrlN || isCtrlP) event.preventDefault(); - if (isCtrlN) this._focusNext(); - if (isCtrlP) this._focusPrevious(); + if (isDown || isDown || isCtrlN || isCtrlP) event.preventDefault(); + if (isDown || isCtrlN) this._focusNext(); + if (isUp || isCtrlP) this._focusPrevious(); } _registerClickEvents() {