Skip to content

Add "Ask Duck.ai" action when selecting text - #9740

Open
joshliebe wants to merge 70 commits into
developfrom
feature/josh/ask-duck-ai
Open

Add "Ask Duck.ai" action when selecting text#9740
joshliebe wants to merge 70 commits into
developfrom
feature/josh/ask-duck-ai

Conversation

@joshliebe

@joshliebe joshliebe commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Task/Issue URL: https://app.asana.com/1/137249556945/project/1200204095367872/task/1218242278110771?focus=true
Tech Design URL (if applicable): https://app.asana.com/1/137249556945/project/1200204095367872/task/1218282058361623
API Proposals URL(s) (if applicable): https://app.asana.com/1/137249556945/project/1200204095367872/task/1218270501055399
https://app.asana.com/1/137249556945/project/1200204095367872/task/1218282058361632

Description

  • Adds an "Ask Duck.ai" action to the text selection menu in order to allow the user to attach the selected text to Duck.ai before prompting.
  • The action is available when selecting text in DuckDuckGo and external apps that handle PROCESS_TEXT.

Steps to test this PR

From DDG

  • Open a site e.g. example.com
  • Select some text and long press
  • Verify that the "Ask Duck.ai" is visible in the text selection toolbar
  • Tap "Ask Duck.ai"
  • Verify that contextual is opened with the selection attached
  • Verify that the correct number words are counted followed by the beginning of the text
  • Submit a prompt
  • Verify that the selection is submitted to Duck.ai

Summarize

  • Open a site in new tab e.g. example.com
  • Select some text and long press
  • Select "Summarize this selection"
  • Verify that the selection is submitted to Duck.ai and summarized

Translation

  • Change the phone language to another language (e.g. Spanish)
  • Open a site in a new tab e.g. example.com
  • Select some text and long press
  • Select "Translate this selection"
  • Verify that the selection is translated

Multiple selections

  • Add multiple selections
  • Verify that suggestions are hidden for more than one attachment
  • Verify that a message is shown if you try to exceed 5 selections
  • Submit a prompt
  • Verify that all the selections are submitted

Duck.ai

  • Long press some text in Duck.ai
  • Verify that "Ask Duck.ai" is not available

From External (Firefox, Opera)

  • Open a site e.g. example.com
  • Select some text and long press
  • Verify that the "Ask Duck.ai" is visible in the overflow menu
  • Tap "Ask Duck.ai"
  • Verify that full screen Duck.ai is opened with the selection attached
  • Submit a prompt
  • Verify that the selection is submitted

Disabled

  • Disable "duckAiTextSelectionAction" in FF inventory
  • Restart the app
  • Long press some text
  • Verify that the action is not available
  • Go to Firefox, Opera
  • Long press some text
  • Verify that the action is not available in the overflow

UI changes

DuckDuckGo

Before After
Screenshot_20260910_014741 Screenshot_20260910_014844

Firefox

Before After
Screenshot_20260910_014801 Screenshot_20260910_014855

Attached

Contextual Fullscreen
Screenshot_20260910_015657 Screenshot_20260910_015735

Note

Medium Risk
Touches browser launch intents, WebView action mode, and Duck.ai prompt payloads; gated behind remote feature flags but spans app and duckchat modules.

Overview
Adds "Ask Duck.ai" to the system text-selection flow so users can send highlighted text into Duck.ai from the browser and other apps via PROCESS_TEXT.

In-app WebView: DuckDuckGoWebView wraps the selection action mode so Ask Duck.ai appears as a primary action (hidden on Duck.ai pages). A feature-flagged SelectedTextDuckAiActivity and TextSelectionToggler register or disable that handler.

Navigation: BrowserNav.openDuckChat and BrowserActivity intents now carry contextual vs full-tab Duck.ai plus optional text selection; contextual opens call launchContextualDuckAi, otherwise selections are stashed and passed into native Duck.ai input when the tab loads.

Composer & chat: Per-tab TextSelectionRepository (cap of 5) backs attachment chips in native input; submissions include a selections JSON array on submitAIChatNativePrompt. Contextual entry skips auto page-context when selections are present, shows selection-specific quick prompts, and hands selections through to the contextual sheet/webview.

Reviewed by Cursor Bugbot for commit 99f7022. Bugbot is set up for automated code reviews on this repo. Configure here.

joshliebe commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@joshliebe
joshliebe force-pushed the feature/josh/ask-duck-ai branch from fc325f9 to 384f004 Compare September 8, 2026 00:12

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread app/src/main/java/com/duckduckgo/app/browser/navigation/AppBrowserNav.kt Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread app/src/main/java/com/duckduckgo/app/browser/DuckDuckGoWebView.kt Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt Outdated
@joshliebe
joshliebe force-pushed the feature/josh/ask-duck-ai branch from dc7f5f2 to 765c20b Compare September 9, 2026 19:10

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 765c20b. Configure here.

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.

2 participants