From f895327eb0efc325309fea02eb4030eb8301916a Mon Sep 17 00:00:00 2001 From: Daniel Dada Date: Thu, 20 Nov 2025 22:46:58 +0300 Subject: [PATCH] fix: correct matches list buttons handling fix: pressing on the match list item triggers jump to the current match --- src/popup/PopupController.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/popup/PopupController.ts b/src/popup/PopupController.ts index b64a801..1f3fee2 100644 --- a/src/popup/PopupController.ts +++ b/src/popup/PopupController.ts @@ -339,12 +339,17 @@ export class PopupController { const word = item.dataset.word; 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); - } else if (target.classList.contains('highlight-next')) { + } else if (button?.classList.contains('highlight-next')) { + e.stopPropagation(); await this.navigateHighlight(word, 1); - } else { - await this.jumpToHighlight(word, 0); + } else if (!button) { + const currentIndex = this.highlightIndices.get(word) || 0; + await this.jumpToHighlight(word, currentIndex); } }); }