forked from extern/the-glorious-startpage
fix webmenu search erasure bug
This commit is contained in:
parent
b11ac06301
commit
083ac06021
@ -288,7 +288,8 @@ const navigateWithArrows = (key, len) => {
|
|||||||
// viewport width
|
// viewport width
|
||||||
const vw = (unit) => window.innerWidth * (unit / 100);
|
const vw = (unit) => window.innerWidth * (unit / 100);
|
||||||
|
|
||||||
// Gets the number of columns by dividing the screen width minus the padding, scroll width and average of menu item width by the menu item width
|
// Gets the number of columns by dividing the screen width minus the padding, scroll width and
|
||||||
|
// average of menu item width by the menu item width
|
||||||
const containerWindow = ((window.innerWidth - (menuItemWidth / 2) - scrollBarWidth - vw(24)) / menuItemWidth);
|
const containerWindow = ((window.innerWidth - (menuItemWidth / 2) - scrollBarWidth - vw(24)) / menuItemWidth);
|
||||||
// Get rounded result
|
// Get rounded result
|
||||||
return Math.round(containerWindow);
|
return Math.round(containerWindow);
|
||||||
@ -299,15 +300,23 @@ const navigateWithArrows = (key, len) => {
|
|||||||
switch (key) {
|
switch (key) {
|
||||||
case right:
|
case right:
|
||||||
webListIndex++;
|
webListIndex++;
|
||||||
|
// Clear web menu searchbox
|
||||||
|
webMenuSearchBox.value = '';
|
||||||
break;
|
break;
|
||||||
case left:
|
case left:
|
||||||
webListIndex--;
|
webListIndex--;
|
||||||
|
// Clear web menu searchbox
|
||||||
|
webMenuSearchBox.value = '';
|
||||||
break;
|
break;
|
||||||
case up:
|
case up:
|
||||||
webListIndex = webListIndex - getIndexByWindowWidth();
|
webListIndex = webListIndex - getIndexByWindowWidth();
|
||||||
|
// Clear web menu searchbox
|
||||||
|
webMenuSearchBox.value = '';
|
||||||
break;
|
break;
|
||||||
case down:
|
case down:
|
||||||
webListIndex = webListIndex + getIndexByWindowWidth();
|
webListIndex = webListIndex + getIndexByWindowWidth();
|
||||||
|
// Clear web menu searchbox
|
||||||
|
webMenuSearchBox.value = '';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -329,8 +338,7 @@ const navigateWithArrows = (key, len) => {
|
|||||||
if (key === down) { return changeItemFocus((webListIndex <= len), 0) }
|
if (key === down) { return changeItemFocus((webListIndex <= len), 0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear web menu searchbox
|
|
||||||
webMenuSearchBox.value = '';
|
|
||||||
changeWebListIndex();
|
changeWebListIndex();
|
||||||
if (webItemFocus) {
|
if (webItemFocus) {
|
||||||
removeClass(webItemFocus, 'webItemFocus');
|
removeClass(webItemFocus, 'webItemFocus');
|
||||||
|
Loading…
Reference in New Issue
Block a user