From ab6373496e5108cde1b69948f701a7aef51517b8 Mon Sep 17 00:00:00 2001 From: Andres Hermosilla Date: Thu, 25 Feb 2021 14:52:46 -0800 Subject: [PATCH] Change sorting of options to be based on size of option Signed-off-by: Andres Hermosilla --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 1b8b0432e..d5f624909 100644 --- a/src/index.js +++ b/src/index.js @@ -100,7 +100,7 @@ document.addEventListener("DOMContentLoaded", function() { Object.entries(widget.options).map(pair => { const [idx, el] = pair; const opts = [...new Set(el._options)]; - opts.sort(); + opts.sort((a, b) => a.length - b.length); opts.map(o => { const ol = document.createElement('option'); ol.innerText = o;