0

I have a script that gives the focus to a specific element in a popped up div when pressing the down key in a textbox. Worked well until I added a sidebar navigation pane using an Bootstrap offcanvas component.

Now, even though the script still does correctly identify the element to be given the focus to, instead of giving this element the focus, it gives it to the last link of the sidebar...

Any idea how I could resolve this issue?

Atchoum
  • 703
  • 8
  • 16

1 Answers1

0

The issue is only with the down arrow key. I can set the focus fine when using a regular character key.

The workaround I found is to use setTimeout to wait 10 ms before I set the focus to my element. So the focus goes to the last link of the navbar because I can't seem to find a way to prevent it, then I give the focus to the correct element.

Atchoum
  • 703
  • 8
  • 16