From b6400b3d1ae42cafcdb02df05851a5b2daa6960e Mon Sep 17 00:00:00 2001 From: mhassman Date: Tue, 18 May 2021 22:26:19 -0400 Subject: [PATCH] Update AutoSuggest.js getComputedStyle(element, 'line-height') was returning 'normal' thus NaN and placing the .top position incorrectly at zero. Fixed by defaulting to font-height if line-height isn't numeric. --- src/AutoSuggest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AutoSuggest.js b/src/AutoSuggest.js index b0c2911..ef91a8e 100644 --- a/src/AutoSuggest.js +++ b/src/AutoSuggest.js @@ -25,7 +25,7 @@ function splitValue(originalValue, cursorPosition, trigger) { function getCharHeight(...elements) { return Math.max(...elements.map(element => ( - parseFloat(getComputedStyle(element, 'line-height')) + return (!isNaN(parseFloat(getComputedStyle(element, 'line-height'))) ? parseFloat(getComputedStyle(element, 'line-height')) : parseFloat(getComputedStyle(element, 'font-size'))); ))); }