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

fix: nav highlight shouldn't follow mouse pos when using nav arrows #257

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

ghiscoding
Copy link
Owner

@ghiscoding ghiscoding commented Mar 21, 2024

  • when using arrow keys to change navigation highlight, it triggers couple of cascading events (1. onScroll event => 2. onMouseOver event). The onMouseOver has the side effect of changing the highlight to current mouse position, so that indirectly affected the arrow navigation since instead of staying at the bottom end, it was always resetting to mouse position (as shown in animated gif below). To counter this problem, we can save the last know mouse position and compare it inside the mouseover, if the position is exactly the same then we know that we're not using the mouse but we are actually using arrow navigation (so we skip mouseover exec)

below is the mouseover problem demoed

this PR fixes the issue observed below (when the mouse is over the options list)

brave_1ezRIpK06H

Copy link

stackblitz bot commented Mar 21, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

Playwright E2E Test Results

78 tests  ±0   78 ✅ ±0   1m 46s ⏱️ -5s
69 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit ee7f1d2. ± Comparison against base commit 57f8d6a.

@ghiscoding ghiscoding merged commit 3c4950d into main Mar 21, 2024
3 checks passed
@ghiscoding ghiscoding deleted the bugfix/mouseover-nav-arrow branch March 21, 2024 06:33
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

Successfully merging this pull request may close these issues.

1 participant