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

De-selecting a search category is sometimes ignored. [bug] [low priority] #2411

Closed
LilithHafner opened this issue Jan 19, 2024 · 0 comments · Fixed by #2415
Closed

De-selecting a search category is sometimes ignored. [bug] [low priority] #2411

LilithHafner opened this issue Jan 19, 2024 · 0 comments · Fixed by #2415
Labels
Format: HTML Related to the default HTML output Type: Bug

Comments

@LilithHafner
Copy link
Contributor

When de-selecting a search category and immediately resuming typing (within 300ms), the de-selection is not registered. This is due to the use of a a single debounce timer shared between get_filters and update_search which allows a debounced get_filter call and a subsequent debounced update_search call get handled by a single update_search call which notably fails to update filters in this case.

$(document).on("keyup", ".documenter-search-input", function (event) {
// Adding a debounce to prevent disruptions from super-speed typing!
debounce(() => update_search(filter_results), 300);
});
$(document).on("click", ".search-filter", function () {
if ($(this).hasClass("search-filter-selected")) {
$(this).removeClass("search-filter-selected");
} else {
$(this).addClass("search-filter-selected");
}
// Adding a debounce to prevent disruptions from crazy clicking!
debounce(() => get_filters(), 300);
});
/**
* A debounce function, takes a function and an optional timeout in milliseconds
*
* @function callback
* @param {number} timeout
*/
function debounce(callback, timeout = 300) {
clearTimeout(timer);
timer = setTimeout(callback, timeout);
}

#2407 should make the required interaction speed 100ms instead of 300ms which should make this issue nearly impossible to reproduce for folks not using automated GUI interaction.

Implementing #2410, however, would streamline the GUI to the point where even at 100ms it would be plausible to run into this bug accidentally.

@mortenpi mortenpi added Type: Bug Format: HTML Related to the default HTML output labels Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Format: HTML Related to the default HTML output Type: Bug
Projects
None yet
2 participants