diff options
Diffstat (limited to 'app/assets/javascripts/feature_highlight')
-rw-r--r-- | app/assets/javascripts/feature_highlight/feature_highlight.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/assets/javascripts/feature_highlight/feature_highlight.js b/app/assets/javascripts/feature_highlight/feature_highlight.js index 173fe7c69de..be55e6923c6 100644 --- a/app/assets/javascripts/feature_highlight/feature_highlight.js +++ b/app/assets/javascripts/feature_highlight/feature_highlight.js @@ -31,12 +31,14 @@ export function setupFeatureHighlightPopover(id, debounceTimeout = 300) { .removeAttr('disabled'); } +const getPriority = e => parseInt(e.dataset.highlightPriority, 10) || 0; + export function findHighestPriorityFeature() { let priorityFeature; const sortedFeatureEls = [].slice .call(document.querySelectorAll('.js-feature-highlight')) - .sort((a, b) => (a.dataset.highlightPriority || 0) < (b.dataset.highlightPriority || 0)); + .sort((a, b) => getPriority(b) - getPriority(a)); const [priorityFeatureEl] = sortedFeatureEls; if (priorityFeatureEl) { |