Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(ui): highlight the first member search match so Enter picks it (#37429)

yuneng-jiangc94d692864fb
diff --git a/ui/litellm-dashboard/src/components/common_components/user_search_modal.test.tsx b/ui/litellm-dashboard/src/components/common_components/user_search_modal.test.tsx
index d17948b599e..cbaf00b7131 100644
--- a/ui/litellm-dashboard/src/components/common_components/user_search_modal.test.tsx
+++ b/ui/litellm-dashboard/src/components/common_components/user_search_modal.test.tsx
@@ -161,6 +161,26 @@ describe("UserSearchModal submit payload", () => {
});
});
+ it("commits the first match when the typed search is confirmed with Enter", async () => {
+ const { user, onSubmit } = setup();
+
+ const input = getEmailSearchInput();
+ await user.click(input);
+ await user.type(input, "pick");
+ await waitFor(() => expect(userFilterUICall).toHaveBeenCalled(), { timeout: 3000 });
+ await screen.findByRole("option", { name: "[email protected]" });
+
+ await user.keyboard("{Enter}");
+ await user.click(save());
+
+ await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1));
+ expect(onSubmit.mock.calls[0][0]).toStrictEqual({
+ user_email: "[email protected]",
+ user_id: "u-1",
+ role: "user",
+ });
+ });
+
it("does not submit on Enter in any field, while the button still does", async () => {
const { user, onSubmit } = setup();
diff --git a/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx b/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx
index 801d19244f8..aeead9d82e6 100644
--- a/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx
+++ b/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx
@@ -165,6 +165,9 @@ const UserSearchModal: React.FC<UserSearchModalProps> = ({
<Combobox
items={items}
value={selected}
+ // @ts-expect-error TS2322 -- Combobox.Root narrows autoHighlight to boolean; the AriaCombobox it wraps
+ // accepts "always", the only value that highlights a list this component filters server-side
+ autoHighlight="always"
filter={null}
onValueChange={(option: UserOption | null) => {
controlProps.onChange(option?.value);