Skip to content

Commit

Permalink
Merge pull request #48 from SDFIdk/fix_listener_bugs
Browse files Browse the repository at this point in the history
Fix keydown listener bug
  • Loading branch information
iamfrank authored Jun 4, 2024
2 parents 5ce8851 + 870afda commit b338747
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ class GSearchUI extends HTMLElement {

moveActiveItemHandler(direction) {
const current_item = this.querySelector('.active')
if (!current_item) {
return
}
const next_item = current_item[`${ direction }Sibling`]
if (next_item) {
this.setFocusOnElement(next_item)
Expand All @@ -264,6 +267,9 @@ class GSearchUI extends HTMLElement {

selectActiveItemHandler() {
const current_item = this.querySelector('.active')
if (!current_item) {
return
}
// Dispatch click event to set selection methods on element in motion
current_item.dispatchEvent(new Event('click'))
this.endSearchHandler()
Expand Down

0 comments on commit b338747

Please sign in to comment.