skills icon indicating copy to clipboard operation
skills copied to clipboard

Research: Make link prefetching in people search work with arrow keys

Open RandomTannenbaum opened this issue 10 months ago • 0 comments

Currently the link prefetching in the people skills dropdown only works when using a mouse, since turbo only listens for mouseenter events on links. To make the experience smoother for keyboard users it would be nice to make link prefetching work when navigating the dropdown with the arrow keys.

The only solution I found so far is using some pretty ugly JavaScript (in the connect method of the stimulus dropdown_controller), which looks like this:

document.querySelector('.ss-search input').addEventListener('keydown', (event) => {
  const key = event.key;
  if(key === "ArrowDown" || key === "ArrowUp") {
    document.querySelector('.ss-highlighted a').dispatchEvent(new Event('mouseenter'));
  }
})

ToDo

  • Take some time to find out if you can come up with a prettier solution

RandomTannenbaum avatar Feb 24 '25 12:02 RandomTannenbaum