Make the HubSpot AI Assistant Popup Floating/Draggable (Detachable Panel)

Status: Idea Submitted

Summary

Enable the HubSpot AI Assistant to open as a floating, draggable, resizable panel that can be pinned and persist across navigation. This makes the Assistant usable side‑by‑side with records, emails, sequences, workflows, and reports without covering critical UI elements.

Problem

Today the Assistant opens in a fixed popup that obscures page content and often loses context on navigation. This interrupts workflows (e.g., drafting emails, enriching records, building reports) and forces repeated open/close cycles.

Proposal

Add a Floating Mode to the AI Assistant with the following capabilities:

  • Draggable/Detachable panel: click‑and‑drag by header; optional snap to screen edges.
  • Resizable: minimum/maximum bounds; remembers last size and position per user.
  • Pin/Unpin: keep the panel on top while navigating to other CRM objects.
  • Mini mode: compact “dock” (icon + last prompt preview) that expands on click.
  • Persistence: single Assistant instance persists across SPA routes and browser tabs (configurable), preserving history/state.
  • Context injection: automatically receive object type + object ID (e.g., Contact 123, Deal 456) and current surface (Inbox, Deals, Lists, Workflows) to tailor suggestions.
  • Open with selection: when text is selected in an editor/field, “Ask AI” opens Floating Mode prefilled with the selection.
  • Keyboard shortcut: global toggle (e.g., Alt/Option + J) with conflict‑safe remapping.
  • Granular privacy: visual badges indicating what context is being shared; quick toggle to pause context sharing.

Key Use Cases

  1. Email drafting in CRM or Inbox: keep the email editor visible while the Assistant refines copy or generates replies.
  2. Data enrichment: view Contact/Company fields while asking AI to propose titles, segmentation tags, or next steps.
  3. Deal/ticket notes: summarize long timelines without hiding the record timeline or activity feed.
  4. List building & filters: design a list while asking the Assistant to propose criteria or QA the logic.
  5. Reports: iterate on report descriptions and insights while keeping the chart/table visible.

UX Details

  • Entry points: existing “Ask AI” buttons + right‑click selection + command palette.
  • Layout: header (drag handle, pin, minimize, close); body (chat); footer (input, actions).
  • Z‑index discipline: panel sits above app content but below modals; when a modal opens, panel auto‑minimizes to mini‑dock unless pinned to modal.
  • Multi‑panel: allow one global panel + one contextual sub‑panel (optional, admin‑gated).
  • Mobile: bottom‑sheet variant with swipe‑to‑minimize; remembers state between views.

Accessibility

  • Keyboard: full focus‑trap navigation; escape to close; ARIA roles for dialog and movable regions.
  • High‑contrast: theme‑aware; respects OS and HubSpot theme.
  • Screen readers: announce context changes (e.g., “Context: Contact • Jane Doe”).

Privacy & Security

  • Context disclosure: clearly show which object(s) and fields are being sent to the model; quick “pause context” switch.
  • Admin controls: org‑level policies to allow/deny floating mode, context types, and cross‑tab persistence.
  • Data residency: inherits existing HubSpot AI compliance; no new data surfaces introduced.

Configuration Options

  • User: enable/disable Floating Mode; remember size/position; keyboard shortcut; default pinned state.
  • Admin: default org policy; restrict by workspace/object; telemetry opt‑in; cross‑tab persistence policy.

Technical Considerations

  • Single global instance mounted at app root (e.g., React portal) with state persisted in memory + optional localStorage for position/size.
  • Route persistence across SPA navigation; on hard reload, restore last state if policy allows.
  • Editor hooks for “Open with selection” in email, notes, comments, descriptions.
  • Event bus for context updates (object focus, selection, surface) with throttling/debouncing.

Success Metrics

  • ↑ Task completion rate without switching views.
  • ↓ Time‑to‑first‑draft for emails/notes.
  • ↑ Repeat usage sessions > 5 minutes with panel pinned.
  • ↓ Open/close cycles per session.
  • CSAT/NPS for Assistant usability.

Alternatives Considered

  • Static sidebar: helps on wide screens but still consumes permanent horizontal space and doesn’t persist across surfaces.
  • Full‑page Assistant: great for deep work, poor for quick side‑by‑side tasks.

Call to Action

Please add a Floating/Draggable AI Assistant Panel that can be pinned, resized, and persisted across navigation—with clear context controls. This will remove friction, preserve focus, and significantly improve real‑world productivity across CRM workflows.

Developer Addendum — Implementation Hints (based on current iframe)

Observed DOM (from DevTools)

Proposed Architecture

  • Root‑level Portal: mount a single global Floating Assistant container (React portal at app root). Host the same iframe within this container.

  • Container: <div data-hs-ai-floating> with header (drag handle, pin, minimize, close), body (iframe), footer (input/actions). Persist position, size, pinned, mini in localStorage scoped by {portalId}:{userId}.

  • Drag & Resize:

    • Drag by header via Pointer Events; clamp within visualViewport (respect env(safe-area-inset-*)).
    • Resize via CSS resize: both; plus custom handles for fine control; min 320×360, max min(90vw, 1280) × min(90vh, 900).
  • Persistence Across SPA Routes: do not unmount on route change; update context via events rather than re-rendering the iframe.

  • Mini‑Dock: collapsed chip (bottom‑right by default) showing icon + last prompt; expands on click.

Context & Messaging Contract

Even if same‑origin (app.hubspot.com), prefer an explicit postMessage API for decoupling.

  • Parent → Iframe (allowedOrigins: https://app.hubspot.com😞

    • hs-context-update { portalId, surface, objectTypeId, objectId, pathname }
    • hs-selection { text, fieldHint } (when opened from a text selection)
    • hs-visibility { state: “show” | “hide” | “mini” }
    • hs-privacy-toggle { paused: boolean }
  • Iframe → Parent:

    • hs-size-request { width, height } (for content‑driven resize hints)
    • hs-focus { wantFocus: boolean }
    • hs-session-state { hasThread, lastPromptAt }
  • Versioning: include schemaVersion in messages to allow safe rollout.

Z‑Index & Modal Interop

  • Layering guideline: content < floating (1070) < drawers (1080) < modals (1100).
  • When a modal opens, if not pinned, auto‑minimize to mini‑dock; if pinned, stay visible but reduce opacity to 0.9 and add aria-hidden to underlying content.

Keyboard & A11y

  • Global toggle shortcut (e.g., Alt/Option + J, remappable).
  • role=“dialog” aria-label=“AI Assistant” aria-modal=“false” on container; focus trap within container; Esc to close/minimize; announce context changes (e.g., “Context: Contact • 0‑1 • 161934500533”).

Privacy/Controls

  • Context badge in header (e.g., Contact • 0‑1:161934500533 • Inbox).
  • One‑click Pause context; persist per surface.
  • Admin policies: allow/deny floating mode, cross‑tab persistence, context types.

Styling & Theming

  • Move current inline gradient/border/shadow into theme tokens (--hs-surface, --hs-elevation-3, etc.).
  • Respect HubSpot theme and OS high‑contrast settings.
  • Support LTR/RTL.

Persistence & Telemetry

  • Persist last size/position (localStorage + optional server sync).
  • Capture metrics: open/close cycles, pinned sessions >5min, time‑to‑first‑draft.

Mobile Variant

  • Bottom‑sheet sheet with swipe‑to‑minimize; remember last state; ensure 48px min touch targets.

Edge Cases

  • Narrow viewports (<768px): default to docked mini; prevent off‑screen drag.
  • Iframe reloads: debounce context-update after route changes.
  • Editors with custom key handlers: namespace shortcuts to avoid conflicts.

Migration Path

  • Keep current sidebar as default. Add Floating Mode toggle in the Assistant menu. Store per‑user preference. Roll out behind a feature flag; GA after telemetry targets are met.

Security Notes

  • Restrict postMessage allowedOrigins and include csrfToken/nonce if needed.
  • Consider iframe allow attributes (e.g., clipboard-write) and CSP updates as required.