Skip to content

Add draggable reader translation popup - #1459

Open
stephenchiao wants to merge 1 commit into
windingwind:mainfrom
stephenchiao:agent/draggable-translation-popup
Open

Add draggable reader translation popup#1459
stephenchiao wants to merge 1 commit into
windingwind:mainfrom
stephenchiao:agent/draggable-translation-popup

Conversation

@stephenchiao

Copy link
Copy Markdown

Summary

  • add a dedicated drag handle to the reader selection translation popup
  • move the popup with the CSS translate property so Zotero's native positioning transform remains intact
  • keep the popup inside the reader viewport and reset its offset for each new text selection
  • add localized drag-handle tooltips for English, Simplified Chinese, and Italian

Motivation

Zotero's selection popup is anchored above or below the selected text. When a translation grows, the popup can cover figures or other content that the user is reading. The existing textarea can be resized, but the popup cannot be moved.

This change lets users drag the complete popup from a small, dedicated handle without interfering with text selection, textarea resizing, color controls, or note actions.

Implementation notes

The drag interaction uses Pointer Events and pointer capture within the reader document. The plugin updates the individual CSS translate property rather than replacing style.transform, which is controlled by Zotero's reader popup positioning. Movement is clamped to the reader viewport, including after translated content changes the popup size.

Validation

  • npx prettier --check src/modules/popup.ts
  • npx eslint src/modules/popup.ts
  • npm run build

The production XPI builds successfully.

@stephenchiao
stephenchiao marked this pull request as ready for review August 18, 2026 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant