Skip to content

Add a margin button to ask the assistant about a paragraph#4328

Open
zenoachtig wants to merge 4 commits into
mainfrom
claude/distracted-engelbart-c85d66
Open

Add a margin button to ask the assistant about a paragraph#4328
zenoachtig wants to merge 4 commits into
mainfrom
claude/distracted-engelbart-c85d66

Conversation

@zenoachtig

Copy link
Copy Markdown
Contributor

Overview

  • Hovering a paragraph (on devices with a fine pointer) now reveals a small assistant icon in the document margin.
  • Clicking it stages the paragraph's text as context and opens the assistant — the same reference flow as the text-selection "Ask" button, but discoverable without selecting anything first.
  • Works for every paragraph, including those nested in lists, steppers, hints, and quotes. Per-block position nudges (declared inline via in-[…] ancestor variants, localized to AskAIParagraphButton) keep it clear of markers/rails/borders; it's hidden inside tables and on touch / hover-less devices.
  • The affordance is purely additive and absolutely positioned, so it never affects document flow, and only renders when the site is in Assistant mode.
  • Generalizes the existing ai_chat_ask_about_page label into a reusable ai_chat_ask_about ("Ask ${1} about ${2}") with new this_page / this_text keys across all locales, so the page action and the paragraph button share one parameterized string.

Demo

Margin button revealed on hover (top-level paragraph):

On nested content (list items):

Clicking stages the paragraph as a reference in the assistant:

— Authored by Claude

zenoachtig and others added 2 commits June 19, 2026 17:26
Make the "ask the assistant about a selection" feature more discoverable by
adding a hover-revealed icon button in the document margin for every paragraph.

- AskAIParagraphButton: an absolutely-positioned, pointer-fine-only button that
  stages the paragraph's text as a chat reference and opens/focuses the assistant.
  Per-block position nudges live in the component via `in-[…]` ancestor variants.
- Paragraph: wrap each paragraph in a `group/ask-ai` container and render the
  button when the site is in Assistant mode (on screen, non-empty paragraphs).
- i18n: generalize `ai_chat_ask_about_page` -> `ai_chat_ask_about` with a
  parameterized target and add `this_page`/`this_text` keys across all locales;
  update PageActions to pass the target.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jun 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0ffe0ee

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
gitbook Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@argos-ci

argos-ci Bot commented Jun 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
customers-v2-cloudflare (Inspect) ✅ No changes detected - Jun 19, 2026, 3:45 PM
customers-v2-vercel (Inspect) ✅ No changes detected - Jun 19, 2026, 3:45 PM
v2-cloudflare (Inspect) ⚠️ Changes detected (Review) 1 changed Jun 19, 2026, 3:51 PM
v2-vercel (Inspect) ✅ No changes detected - Jun 19, 2026, 3:50 PM

Show the button at full opacity when revealed instead of dimming it to 50%.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The per-block nudge comment referenced a removed `blockContextOffset` constant;
describe the inline `in-[…]` approach instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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