Focus issue on first keypress
ironically this page doesn't have this feature yet
dang it it's not perfect i thought it was, i need the original functionality which goes to the next element further down the dom tree if the letter is different for example if the focus is on
<a class="drop-sub-topic " href="#"><h3>Web Pages</h3></a>
and the letter "c" is pressed it should go the
<a class="project" href="webPages/chatGpt-questions/index.html">
<h3>ChatGpt Questiong - web page or extension??
non-extension</h3>
</a>
and not back up to the chat gpt under extensions, i originally fixed this logic with the
if (letter !== lastLetterPressed) {
// New letter key pressed
if (e.shiftKey) {
// Go up the page from current position
const previous = [...letteredAs].reverse().find(a => allAs.indexOf(a) < iActiveA)
iLetter=letteredAs.indexOf(previous)
if (iLetter===-1) iLetter=letteredAs.length - 1 // fallback to last match
} else { // Go down the page from current position
const next=letteredAs.find(a=> allAs.indexOf(a) > iActiveA)
iLetter = letteredAs.indexOf(next)
if (iLetter === -1) iLetter = 0 // fallback to first match
}
} else {
// Same letter key pressed again
if (e.shiftKey) {
iLetter = (currentIndexInFiltered - 1 + letteredAs.length) % letteredAs.length
} else {
iLetter = (currentIndexInFiltered + 1) % letteredAs.length
}
}