only start searching on enter and search button click (#28040)

fixes: #27917

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-03-22 12:06:43 +01:00 committed by GitHub
parent 3ad233b890
commit b321c4b406
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -97,16 +97,14 @@ export function UserDataTableToolbarItems({
placeholder={t("searchForUser")} placeholder={t("searchForUser")}
aria-label={t("search")} aria-label={t("search")}
value={searchUser} value={searchUser}
onChange={(_, value) => { onSearch={(_, _v, attribute) => {
setSearchUser(value); setSearchUser(attribute["haswords"]);
}}
onSearch={() => {
setSearchUser(searchUser);
refresh(); refresh();
}} }}
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === "Enter") { if (e.key === "Enter") {
setSearchUser(searchUser); const target = e.target as HTMLInputElement;
setSearchUser(target.value);
refresh(); refresh();
} }
}} }}