Skip to content

Commit 4aabcd5

Browse files
committed
[bug] fix auto suggest up and down keyboard navigation
1 parent 008694b commit 4aabcd5

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nightTab",
3-
"version": "6.1.0",
3+
"version": "6.1.1",
44
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
55
"main": "index.js",
66
"scripts": {

src/js/auto-suggest.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ var autoSuggest = (function() {
5252
var elementToFocus = null;
5353
var focusIndex = null;
5454
var allSuggestItems = helper.eA(".auto-suggest-item");
55+
var columnCount = getComputedStyle(helper.e(".auto-suggest-list")).getPropertyValue("grid-template-columns").split(" ").length;
5556
var _findInput = function() {
5657
if (event.target.classList.contains("auto-suggest-input")) {
5758
_currentInputOptions.input = event.target;
@@ -71,8 +72,8 @@ var autoSuggest = (function() {
7172
if (focusIndex == null) {
7273
elementToFocus = allSuggestItems[allSuggestItems.length - 1];
7374
} else {
74-
if (focusIndex > 2 && focusIndex <= allSuggestItems.length - 1) {
75-
elementToFocus = allSuggestItems[focusIndex - 3];
75+
if (focusIndex >= columnCount && focusIndex <= allSuggestItems.length - 1) {
76+
elementToFocus = allSuggestItems[focusIndex - columnCount];
7677
} else {
7778
elementToFocus = _currentInputOptions.input;
7879
};
@@ -84,8 +85,8 @@ var autoSuggest = (function() {
8485
if (focusIndex == null) {
8586
elementToFocus = allSuggestItems[0];
8687
} else {
87-
if (focusIndex < allSuggestItems.length - 3) {
88-
elementToFocus = allSuggestItems[focusIndex + 3];
88+
if (focusIndex < allSuggestItems.length - columnCount) {
89+
elementToFocus = allSuggestItems[focusIndex + columnCount];
8990
} else {
9091
elementToFocus = _currentInputOptions.input;
9192
};

src/js/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var version = (function() {
22

3-
var current = "6.1.0";
3+
var current = "6.1.1";
44

55
var name = "Jaded Raven";
66

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nightTab",
33
"short_name": "nightTab",
44
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
5-
"version": "6.1.0",
5+
"version": "6.1.1",
66
"manifest_version": 2,
77
"chrome_url_overrides": {
88
"newtab": "index.html"

0 commit comments

Comments
 (0)