youssefreda9 commited on
Commit
1afad28
·
1 Parent(s): 75e46c4

fix: Tooltip shows no correction buttons for grammar/punctuation — empty array is truthy in JS

Browse files
Files changed (1) hide show
  1. src/js/editor.js +3 -1
src/js/editor.js CHANGED
@@ -379,7 +379,9 @@ function showTooltip(element) {
379
 
380
  // Render alternatives
381
  if (alternativesEl) {
382
- const alts = suggestion.alternatives || [suggestion.correction, suggestion.original];
 
 
383
  let html = '';
384
  // Render corrections first (non-keep)
385
  alts.forEach((alt, i) => {
 
379
 
380
  // Render alternatives
381
  if (alternativesEl) {
382
+ const alts = (suggestion.alternatives && suggestion.alternatives.length > 0)
383
+ ? suggestion.alternatives
384
+ : [suggestion.correction, suggestion.original];
385
  let html = '';
386
  // Render corrections first (non-keep)
387
  alts.forEach((alt, i) => {