diff --git a/src/services/attributes.js b/src/services/attributes.js index d839b58e7..d3e583fe2 100644 --- a/src/services/attributes.js +++ b/src/services/attributes.js @@ -109,7 +109,16 @@ function getAttributeNames(type, nameLike) { } } - names.sort(); + names.sort((a, b) => { + const aPrefix = a.toLowerCase().startsWith(nameLike); + const bPrefix = b.toLowerCase().startsWith(nameLike); + + if (aPrefix !== bPrefix) { + return aPrefix ? -1 : 1; + } + + return a < b ? -1 : 1; + }); return names; }