From 2133fe25c78640e7ceedd654532bcf0427b86683 Mon Sep 17 00:00:00 2001 From: mARTin-B78 Date: Thu, 9 Jul 2026 02:02:31 +0200 Subject: [PATCH] Stop assign popup from retargeting when reusing a name from another paragraph (v1.14.11) Clicking a name inside a paragraph's text always retargeted the "Assign to" popup (and its highlight) to that paragraph, even when the popup was already open for a different one. That made it look like the wrong paragraph was being reassigned when the user just wanted to reuse a name they saw elsewhere. Now, while a popup is open, clicking a name outside its target paragraph only fills the search box. Co-Authored-By: Claude Fable 5 --- CHANGELOG.md | 7 +++++++ VERSION | 2 +- static/index.html | 6 +++--- static/js/audiobook.js | 18 +++++++++++++++++- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcd1232..f56e903 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi --- +## [1.14.11] — 2026-07-09 + +### Fixed +- **Clicking a name inside a paragraph's text silently retargeted the assign popup to that paragraph** — misleading when you open "Assign to" on one (e.g. Unknown) paragraph, then click a name mentioned in a *different* paragraph just to reuse it: the popup would jump to and highlight that other paragraph instead of staying on the one you meant to fix. Now, while a popup is already open, clicking a name elsewhere only fills the search box — it no longer changes which paragraph gets assigned. Clicking a paragraph's own speaker label still always retargets it, as does clicking a name inside a paragraph when no popup is open yet. + +--- + ## [1.14.10] — 2026-07-09 ### Added diff --git a/VERSION b/VERSION index 9beda55..f350950 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.14.10 +1.14.11 diff --git a/static/index.html b/static/index.html index 28d24f2..9b6b493 100644 --- a/static/index.html +++ b/static/index.html @@ -10,7 +10,7 @@ - + @@ -27,7 +27,7 @@ - + @@ -365,7 +365,7 @@ window.toggleNavTree = function(treeId, chevronId) { - + diff --git a/static/js/audiobook.js b/static/js/audiobook.js index 95cefab..debe97a 100644 --- a/static/js/audiobook.js +++ b/static/js/audiobook.js @@ -2798,8 +2798,24 @@ STRIKTE FORMAT- UND TEXTREGELN: if (txtEl && window.getSelection().isCollapsed) { const row = txtEl.closest('.ab-cv-row'); const nameHit = e.target.closest('.ab-name-hit'); + const clickedWord = nameHit ? (nameHit.dataset.name || nameHit.textContent.trim()) + : _abWordRangeAtPoint(e.clientX, e.clientY)?.word; + // If a popup is already open targeting a DIFFERENT paragraph, a click on + // a name elsewhere in the text only borrows that name into the search + // box — it must not silently retarget/highlight the paragraph under the + // cursor, which used to make it look like THAT paragraph was being + // reassigned instead of the one the user actually opened the popup for. + if (assignModeRow && assignModeRow !== row) { + if (clickedWord) { + const inp = assignPopup.querySelector('input'); + inp.value = clickedWord; + inp.dispatchEvent(new Event('input')); + inp.focus(); + } + return; + } if (nameHit) { - _abOpenAssignPopup(row, nameHit, nameHit.dataset.name || nameHit.textContent.trim()); + _abOpenAssignPopup(row, nameHit, clickedWord); } else { const hit = _abWordRangeAtPoint(e.clientX, e.clientY); if (hit) {