fix: correct matches list buttons handling

fix: pressing on the match list item triggers jump to the current match
This commit is contained in:
2025-11-20 22:46:58 +03:00
parent fc4ef8655d
commit f895327eb0

View File

@@ -339,12 +339,17 @@ export class PopupController {
const word = item.dataset.word; const word = item.dataset.word;
if (!word) return; if (!word) return;
if (target.classList.contains('highlight-prev')) { const button = target.closest('button');
if (button?.classList.contains('highlight-prev')) {
e.stopPropagation();
await this.navigateHighlight(word, -1); await this.navigateHighlight(word, -1);
} else if (target.classList.contains('highlight-next')) { } else if (button?.classList.contains('highlight-next')) {
e.stopPropagation();
await this.navigateHighlight(word, 1); await this.navigateHighlight(word, 1);
} else { } else if (!button) {
await this.jumpToHighlight(word, 0); const currentIndex = this.highlightIndices.get(word) || 0;
await this.jumpToHighlight(word, currentIndex);
} }
}); });
} }