Add accessible Ajax user combobox over the preload cap. - #2011
Open
shadyvb wants to merge 1 commit into
Open
Conversation
… cap (XWPENG-55) User pickers (records filter, settings exclude rules, alert author trigger) now share one decision point, Admin::get_preload_users_max() (new wp_stream_preload_users_max filter, default 50): - Under the cap: the native <select> from the previous commit. - Over the cap: an accessible combobox (src/js/utils/user-combobox.js) searching the existing wp_stream_filters endpoint. The hidden input is the only submitted value; blur and form-submit restore the last committed selection so a half-typed query can never win a race against Filter/Save. Roles render as a group inside the listbox (data-role-options), filtered client-side alongside Ajax user results, keeping one control in both modes like the previous Select2 dropdown. Stored values (role slug or user id, including 0 for WP-CLI) keep working unchanged. Supporting changes: - Extract a stateless User_Picker collaborator (classes/class-user-picker.php) and register it on Plugin; DB shrinks back to the stream-record store and Alert_Trigger_Author, Settings_Renderer, Admin_Ajax, and Alerts_List no longer depend on it. - Alert author trigger: save_fields stores any user id (membership checks are impossible when options are not server-rendered); quick edit seeds the saved author from hidden row inputs, fixing the long-standing loss of the value on inline save; the numeric string '0' (WP-CLI) is no longer falsy-dropped in get_display_value() and check_record(), so WP-CLI alerts display and match correctly. - Type Alert::$alert_meta as array, correcting the long-wrong @var int docblock; alert_meta is always an array in practice. - Fix a swapped ($form, $picker) argument order in the exclude-rule renderer's row loop that the unit suite caught before commit. Tests: User_Picker_Test (modes, labels, search, default-cap canary), Log role-exclusion coverage, alert trigger mode/save/display/matching units, ajax nonce rejection, renderer dual-mode markup; e2e suites for the combobox (search/select/clear, race guard, keyboard + aria, wp.a11y announcements, screen options, role/user round trips), alert author trigger end-to-end (fires only for the trigger author, WP-CLI title, quick edit), functional exclude rules, WP-CLI picker labels, multi-IP round trip. Signed-off-by: Shadi Sharaf <shady@sharaf.me>
shadyvb
added this pull request to stack #1987
September 10, 2026 13:58
5 tasks
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes XWPENG-55.
User pickers (records filter, settings exclude rules, alert author trigger) now share one decision point,
Admin::get_preload_users_max()(wp_stream_preload_users_maxfilter, default 50):<select>from Replace remaining Select2 and jquery-timeago uses with native equivalents. #2010.src/js/utils/user-combobox.js) searching the existingwp_stream_filtersendpoint. The hidden input is the only submitted value; blur and form-submit restore the last committed selection so a half-typed query cannot win a race against Filter/Save. Roles render as a group inside the listbox, filtered client-side alongside Ajax user results.A stateless
User_Pickercollaborator owns option building and search; DB shrinks back to the stream-record store. Alert author trigger now stores any user id, seeds the saved author on quick edit, and no longer falsy-drops WP-CLI (0).Stacked on #2010.
Test plan
<select>.