Skip to content

Commit

Permalink
[bug] fix auto suggest up and down keyboard navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieFox committed Aug 12, 2020
1 parent 008694b commit 4aabcd5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nightTab",
"version": "6.1.0",
"version": "6.1.1",
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
"main": "index.js",
"scripts": {
Expand Down
9 changes: 5 additions & 4 deletions src/js/auto-suggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ var autoSuggest = (function() {
var elementToFocus = null;
var focusIndex = null;
var allSuggestItems = helper.eA(".auto-suggest-item");
var columnCount = getComputedStyle(helper.e(".auto-suggest-list")).getPropertyValue("grid-template-columns").split(" ").length;
var _findInput = function() {
if (event.target.classList.contains("auto-suggest-input")) {
_currentInputOptions.input = event.target;
Expand All @@ -71,8 +72,8 @@ var autoSuggest = (function() {
if (focusIndex == null) {
elementToFocus = allSuggestItems[allSuggestItems.length - 1];
} else {
if (focusIndex > 2 && focusIndex <= allSuggestItems.length - 1) {
elementToFocus = allSuggestItems[focusIndex - 3];
if (focusIndex >= columnCount && focusIndex <= allSuggestItems.length - 1) {
elementToFocus = allSuggestItems[focusIndex - columnCount];
} else {
elementToFocus = _currentInputOptions.input;
};
Expand All @@ -84,8 +85,8 @@ var autoSuggest = (function() {
if (focusIndex == null) {
elementToFocus = allSuggestItems[0];
} else {
if (focusIndex < allSuggestItems.length - 3) {
elementToFocus = allSuggestItems[focusIndex + 3];
if (focusIndex < allSuggestItems.length - columnCount) {
elementToFocus = allSuggestItems[focusIndex + columnCount];
} else {
elementToFocus = _currentInputOptions.input;
};
Expand Down
2 changes: 1 addition & 1 deletion src/js/version.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var version = (function() {

var current = "6.1.0";
var current = "6.1.1";

var name = "Jaded Raven";

Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nightTab",
"short_name": "nightTab",
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
"version": "6.1.0",
"version": "6.1.1",
"manifest_version": 2,
"chrome_url_overrides": {
"newtab": "index.html"
Expand Down

0 comments on commit 4aabcd5

Please sign in to comment.