Feature #43825
open
Preserve checkbox selection in autocomplete search for members, group users, and watchers
Added by [Agileware]Kota Uchino 2 days ago.
Updated 1 minute ago.
Description
When adding members, group users, or watchers, checkbox selections are lost when the search query changes.
This makes it difficult to select multiple users while searching.
Save and restore checkbox states across AJAX requests in observeSearchfield.
With this patch, only users currently visible in the search results will be submitted. Users who were checked but are hidden by the current search query will not be included.
I would appreciate feedback on whether this behavior is acceptable or if hidden selections should also be submitted.
Files
- Target version set to Candidate for next minor release
Thank you for posting the patch.
However, I found an issue where a previously unchecked user can be checked again unexpectedly after another search refresh. You can reproduce it with the following steps:
1. Open the "Add" dialog (members/watchers/group).
2. Check user A.
3. Type a search that hides user A.
4. Clear the search so user A appears again.
5. Uncheck user A.
6. Type any new search term that matches user A.
7. Observe that user A is checked again even though it was unchecked.
Uchino-san, could you take a look at the following fix?
It should fix the issue I pointed out in #note-2.
diff --git a/app/assets/javascripts/application-legacy.js b/app/assets/javascripts/application-legacy.js
index bea54ae9a..9490c2748 100644
--- a/app/assets/javascripts/application-legacy.js
+++ b/app/assets/javascripts/application-legacy.js
@@ -810,6 +810,8 @@ function observeSearchfield(fieldId, targetId, url, options) {
$(options.checkboxSelector).each(function() {
if ($(this).prop('checked')) {
checkedValues[$(this).val()] = true;
+ } else {
+ delete checkedValues[$(this).val()];
}
});
}
Also available in: Atom
PDF