[js-embedded-discovery] 02/02: EDS-96 Support ignoring diacritics while searching

Rod Widdowson rdw at steadingsoftware.com
Mon Jun 9 14:19:48 UTC 2025


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository js-embedded-discovery.

View the commit online:
http://git.shibboleth.net/view/?p=js-embedded-discovery.git;a=commit;h=ecc1dce89c2144f441d9048d6323db2a65a9e254

commit ecc1dce89c2144f441d9048d6323db2a65a9e254
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Jun 9 13:13:55 2025 +0100

    EDS-96 Support ignoring diacritics while searching
    
    https://shibboleth.atlassian.net/browse/EDS-96
    
    Add parameterized control of matching diacriticals
---
 src/javascript/idpselect.js        | 15 +++++++++++++--
 src/javascript/idpselect_config.js |  1 +
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/javascript/idpselect.js b/src/javascript/idpselect.js
index 00a06d6..bf24b70 100644
--- a/src/javascript/idpselect.js
+++ b/src/javascript/idpselect.js
@@ -38,6 +38,7 @@ function IdPSelectUI() {
     var showListFirst;
     var noWriteCookie;
     var ignoreURLParams;
+    var extraCompareRegex;
 
     var autoFollowCookie;
     var autoFollowCookieTTLs;
@@ -176,6 +177,8 @@ function IdPSelectUI() {
             ignoreURLParams = false;
         }
 
+        extraCompareRegex = paramsSupplied.extraCompareRegex;
+
         defaultLogo = paramsSupplied.defaultLogo;
         defaultLogoWidth = paramsSupplied.defaultLogoWidth;
         defaultLogoHeight = paramsSupplied.defaultLogoHeight;
@@ -1290,10 +1293,18 @@ function IdPSelectUI() {
     } ;
 
     var compareName = function(compareName, typedName) {
-	if (compareName.toLowerCase().indexOf(typedName) != -1) {
+        if (compareName.toLowerCase().indexOf(typedName) != -1) {
+            return true;
+        }
+        if (extraCompareRegex == null) {
+            return false;
+        }
+        typedName = typedName.normalize("NFD").replace(extraCompareRegex, '');
+        compareName = compareName.normalize("NFD").replace(extraCompareRegex, '');
+        if (compareName.toLowerCase().indexOf(typedName) != -1) {
             return true;
         }
-	return false;
+        return false;
     }
 
     var getKeywords = function(idp) {
diff --git a/src/javascript/idpselect_config.js b/src/javascript/idpselect_config.js
index b68fce9..e69ee7c 100644
--- a/src/javascript/idpselect_config.js
+++ b/src/javascript/idpselect_config.js
@@ -30,6 +30,7 @@ function IdPSelectUIParms(){
     this.samlIdPCookieTTL = 730;     // in days, this cookie is used to offer previously chosen IDP as preferredIdP
     this.samlIdPCookieProps = '; Secure; SameSite=Lax'; // If set to a custom string, the string is appended to the cookie value
     this.setFocusTextBox = true;     // Set to false to supress focus
+    this.extraCompareRegex = null;   // To ignore diacriticals say something like this.extraCompareRegex = new RegExp("\\p{Diacritic}", "gu")
     this.testGUI = false;
 
     this.autoFollowCookie = null;  //  If you want auto-dispatch, set this to the cookie name to use

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list