From e149f5a6c1e2c6fe51b0066511030a998679f411 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Thu, 28 Apr 2022 11:33:09 -0600 Subject: [PATCH 1/2] Return exact search matches at the top of the list --- src/libs/OptionsListUtils.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 04413d6e40b..9e5ea350711 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -598,7 +598,12 @@ function getOptions(reports, personalDetails, activeReportID, { if (!option.login) { return 2; } - return 1; + if (option.login !== searchValue) { + return 1; + } + + // When option.login is an exact match with the search value, returning 0 puts it at the top of the option list + return 0; }], ['asc']); } From 2bff4d199b2f64f3464f80838a5e13410191bfcb Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Thu, 28 Apr 2022 13:40:08 -0600 Subject: [PATCH 2/2] Make search match not be case sensitive --- src/libs/OptionsListUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 9e5ea350711..1beeedb65f7 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -598,7 +598,7 @@ function getOptions(reports, personalDetails, activeReportID, { if (!option.login) { return 2; } - if (option.login !== searchValue) { + if (option.login.toLowerCase() !== searchValue.toLowerCase()) { return 1; }