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

feat: Keep focus on same item in completion popup when slow completer delivers results. #5322

Merged
merged 10 commits into from
Sep 22, 2023

Conversation

akoreman
Copy link
Contributor

@akoreman akoreman commented Sep 22, 2023

Issue #, if available: NA

Description of changes: Currently, when there are new async completion results delivered by a completer, the active row of the popup is set back to 0. This is jarring when there are completers which are sufficiently slow that the user has already started to interact with the other, faster, completion results.

This adds a timer such that when completions are delivered a configurable number of milliseconds after opening the popup, the item in focus remains in focus after the new results are added to the popup.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01% 🎉

Comparison is base (f401013) 87.38% compared to head (a4c7a53) 87.39%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5322      +/-   ##
==========================================
+ Coverage   87.38%   87.39%   +0.01%     
==========================================
  Files         574      574              
  Lines       45534    45594      +60     
  Branches     6935     6938       +3     
==========================================
+ Hits        39788    39848      +60     
  Misses       5746     5746              
Flag Coverage Δ
unittests 87.39% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/autocomplete.js 84.61% <100.00%> (+0.41%) ⬆️
src/autocomplete_test.js 98.61% <100.00%> (+0.20%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -62,6 +62,7 @@ class Autocomplete {
this.keyboardHandler.bindKeys(this.commands);
this.parentNode = null;
this.setSelectOnHover = false;
this.stickySelectionDelay = 500;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add JSDoc comment somehow. for this option, since it's a bit hard to understand from just the name without prior context, but it's a pretty cool functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a (hopefully) descriptive comment about this feature

@akoreman akoreman merged commit 0983134 into ajaxorg:master Sep 22, 2023
@akoreman akoreman deleted the completer_delay branch September 22, 2023 12:49
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.

2 participants