diff options
| author | tanaka takashi <isazaka@gmail.com> | 2026-09-01 20:52:08 +0900 |
|---|---|---|
| committer | tanaka takashi <isazaka@gmail.com> | 2026-09-01 20:52:08 +0900 |
| commit | 305c7479a589e7877074588b6467321f0a49cbdf (patch) | |
| tree | c44a4fb21644fc3d6dc7acf205df527660baee7c /src/content | |
| parent | bb06e0e58dcb90eceede6f0b05743fdccc8f51af (diff) | |
fix: diagnosable translation errors and icon hidden after scroll
Translation error ("設定値が不正です") diagnosis
- The INVALID_SETTINGS code collapsed two unrelated failures into one
opaque message: (a) no model configured in the background settings
cache, and (b) HTTP 400/403 from Ollama with the actual reason in the
response body. Verified against a live Ollama server: the configured
cloud models (glm-5.3:cloud etc.) stream fine from a plain page, so
the generic message gave no clue which path fired.
- ollama-client.js: read the Ollama error body on non-OK responses and
append its message ("model is required" etc.) to the thrown error
- message-router.js: no-model-configured now has its own explicit
message ("モデルが設定されていません...") and concrete detail reasons
are appended to the base message in the popover, e.g.
設定値が不正です。... (Ollama /api/chat failed: 400 - ...)
Action icon disappearing
- The scroll handler hid the action button whenever the popover was
hidden, even with a live selection, leaving no way to translate until
the user re-selected. It now repositions the icon while a selection
exists and only hides it when the selection is gone (Design 5.4).
Results: 73 passed, 0 failed. dist rebuilt.
Diffstat (limited to 'src/content')
| -rw-r--r-- | src/content/content.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/content/content.js b/src/content/content.js index fa5f416..07e6cdc 100644 --- a/src/content/content.js +++ b/src/content/content.js @@ -630,12 +630,20 @@ document.addEventListener('mouseup', onSelectionEvent, { passive: true }); document.addEventListener('keyup', onSelectionEvent, { passive: true }); - // Reposition or hide UI when the viewport changes (Design 5.4). + // Reposition the UI while the viewport changes (Design 5.4). Keep the + // icon visible whenever a selection exists - hiding it on scroll left + // users without any way to translate until they re-selected. window.addEventListener( 'scroll', () => { if (popover.state === POPOVER_STATES.HIDDEN) { - actionButton.hide(); + const selection = readSelection(); + if (selection) { + currentSelectionRect = selection.rect; + actionButton.show(selection.rect); + } else { + actionButton.hide(); + } return; } const selection = readSelection(); |
