Skip to content

feat: add floating (drag-to-move) position for tooltip icons#74

Merged
mountaindude merged 5 commits intomainfrom
copilot/add-movable-tooltip-icons
Mar 19, 2026
Merged

feat: add floating (drag-to-move) position for tooltip icons#74
mountaindude merged 5 commits intomainfrom
copilot/add-movable-tooltip-icons

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 18, 2026

Adds a new floating icon position that lets users reposition tooltip icons via click-drag, constrained within the target element. Click-to-open-dialog still works — a 5px dead-zone distinguishes clicks from drags.

Property panel

  • New dropdown option "Floating (drag to move)" in the icon position selector

Drag behavior (tooltip-injector.js)

  • enableDrag() uses Pointer Events with setPointerCapture for reliable cross-browser drag
  • On pointerdown, converts any right/bottom CSS positioning to explicit left/top so deltas are trivial
  • Movement clamped to parent bounds via getBoundingClientRect()
  • Capture-phase click listener suppresses dialog open after a drag gesture

CSS (style.css)

  • .hbqs-tooltip-trigger--floatingcursor: grab; touch-action: none
  • .hbqs-tooltip-trigger--draggingcursor: grabbing; transition: none; opacity: 0.85

Docs

  • Updated app developer and extension developer guides with floating position details and new modifier class reference
Original prompt

This section details on the original issue you should resolve

<issue_title>Make tooltip icons moveable</issue_title>
<issue_description>

Discussed in #72

Originally posted by mountaindude March 18, 2026
The tooltips currently can have one of a set of predefined positions, for example "top left", "top center", "top right", "center left" etc.
That'd good - do not change that.

Add a new option called "floating" (or something better.. suggest a good name) lets the user move the icon by click-dragging it.
The user should be able to move the icon anywhere within the UI element the icon is associated with.

Note that the click-on-icon to show the tooltip details dialog must still work!

</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: mountaindude <1029262+mountaindude@users.noreply.github.com>
Copilot AI changed the title [WIP] Add movable option for tooltip icons feat: add floating (drag-to-move) position for tooltip icons Mar 18, 2026
Copilot AI requested a review from mountaindude March 18, 2026 19:23
@mountaindude mountaindude requested a review from Copilot March 18, 2026 20:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new tooltip icon position option (floating) to let users reposition tooltip trigger icons via click-drag within the target element, while preserving click-to-open dialog behavior.

Changes:

  • Implemented pointer-based drag-to-move behavior for tooltip icons when iconPosition === 'floating'.
  • Added CSS modifier classes for floating/dragging cursor + interaction styling.
  • Exposed the new option in the property panel and documented the behavior in both developer guides.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
extension/src/ui/tooltip-injector.js Adds floating positioning support and enableDrag() pointer-event drag logic with click suppression after drag.
extension/src/style.css Adds .hbqs-tooltip-trigger--floating and .hbqs-tooltip-trigger--dragging styles (cursor/touch-action/transition/opacity).
extension/src/property-panel/tooltips-section.js Adds "Floating (drag to move)" to the icon position dropdown.
extension/docs/tooltips-developer.md Documents mount lifecycle updates and the new drag behavior + modifier classes.
extension/docs/tooltips-app-developer.md Documents the new floating position option for app developers.

Comment thread extension/src/ui/tooltip-injector.js
Comment thread extension/src/ui/tooltip-injector.js
Comment on lines +299 to +307
const parentRect = parentEl.getBoundingClientRect();
const iconSize = iconEl.offsetWidth;

let newLeft = origLeft + dx;
let newTop = origTop + dy;

// Constrain within parent bounds
newLeft = Math.max(0, Math.min(newLeft, parentRect.width - iconSize));
newTop = Math.max(0, Math.min(newTop, parentRect.height - iconSize));
@mountaindude mountaindude marked this pull request as ready for review March 19, 2026 18:18
@mountaindude mountaindude merged commit 50a2091 into main Mar 19, 2026
2 checks passed
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.

Make tooltip icons moveable

3 participants