fix(ui): improve user filter dropdown when no remote search is configured (#40296)

On the dashboard issue and pull request pages, author and assignee
filters only accept direct username input since candidate lists across
all accessible repositories cannot be pre-fetched. However, the dropdown
inherited several confusing artifacts from the repository-level user
search:

- Displayed a misleading "Shows a maximum of 30 users" tooltip even
though no remote user list was fetched.
- Used "Search users" as placeholder rather than indicating direct
username input.
- Pressing Enter in the input had no effect, requiring mouse selection.
- Any active username filter was not reflected in the dropdown menu on
open.

This change:
- Only renders the 30-user tooltip when a remote search URL is provided.
- Uses "Filter by username…" as placeholder when no remote search URL
exists.
- Applies the filter on Enter keypress.
- Ensures the active username is displayed and selected when opening the
menu.

Fixes: https://github.com/go-gitea/gitea/issues/40275
Fixes: https://github.com/go-gitea/gitea/issues/33426

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Shudhanshu Singhandwxiaoguang authored and GitHub committed 2026-11-09 21:34:43 +00:00
1 parent bccc90d654
commit 2d6dca9abb
3 files changed
+6 -4

No files matched your search

+2 -1
View File
@@ -93,7 +93,7 @@ function initDropdownUserRemoteSearch(el: Element) {
const selectUsername = (username: string) => {
queryElems(elMenu, '.item.active, .item.selected', (el) => el.classList.remove('active', 'selected'));
elMenu.querySelector(`.item[data-value="${CSS.escape(username)}"]`)?.classList.add('selected');
elMenu.querySelector(`.item[data-value="${CSS.escape(username)}"]`)?.classList.add('active');
};
const processedResults: ProcessedIssuePoster[] = []; // to be used by dropdown to generate menu items
@@ -109,6 +109,7 @@ function initDropdownUserRemoteSearch(el: Element) {
elSearchInput.value = selectedUsername;
if (!searchUrl) {
elSearchInput.addEventListener('input', syncItemFromInput);
syncItemFromInput();
return;
}