Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrow key navigation in results of search tab jump around randomly #49

Open
mtalexan opened this issue Apr 4, 2024 · 0 comments
Open

Comments

@mtalexan
Copy link

mtalexan commented Apr 4, 2024

To reproduce:

  1. Open the search tab
  2. Wait for indexing to finish
  3. Type a search term with a number of results (my case = 7 matches)
  4. Press the up and down arrow keys

Expected:

Up arrow key and down arrow key move exactly 1 search result in the given direction.

Actual:

Up and down arrow keys jump the selection by 2-4 results, with no consistency in the number of items it jumps by.


Trying the navigation a lot, it looks like maybe it's watching the key UP event, key DOWN event, and key REPEAT event, which is incorrect implementation. If I tap an arrow key really really fast, it jumps the focus by only 2 (every once in a great while it's by only 1), but if I tap it at a normal speed for a 120 wpm typist, it jumps by 2-4. Sometimes I can even see it jump before I release the key and then again after I release the key (which suggests that it's improperly watching for both the down and up events instead of just the down event).

Proper handling for key input is always, in every programming language and GUI, to watch for only the DOWN event for keys, and only the UP event for mouse clicks. For keys that are held down it depends on the programming framework used as to whether it handles the initial delay before the key starts repeating or not, and whether it handles implementing the maximum repeat rate or not. It appears the framework used here does not do this for you, so you'll have to implement your own manual timer delay from when the key DOWN even is received until you start paying attention to REPEAT events, and another timer for filtering the maximum rate you can get the REPEAT events. The OS provides these events to the browser at superhuman speeds intentionally and it's expected the program/site interprets them properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant