You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the search bar is made visible with the keydown event, it registers the space character.
This adds a whitespace before the actual search term and also causes the cursor to be not perfectly centered but off by 1.
Easy fix:
Change "keydown" to "keyup" in this code segment
document.addEventListener("keydown", event => {
if (event.keyCode == 32) { // Spacebar code to open search
document.getElementById('search').style.display = 'flex';
document.getElementById('search-field').focus();
} else if (event.keyCode == 27) { // Esc to close search
document.getElementById('search-field').value = '';
document.getElementById('search-field').blur();
document.getElementById('search').style.display = 'none';
}
});
The text was updated successfully, but these errors were encountered:
Since the search bar is made visible with the keydown event, it registers the space character.
This adds a whitespace before the actual search term and also causes the cursor to be not perfectly centered but off by 1.
Easy fix:
Change "keydown" to "keyup" in this code segment
The text was updated successfully, but these errors were encountered: