This enhancement would make the "Kagi Summarize" context menu option in the Kagi Firefox extension more precise and reliable by adding context-awareness. The feature would prioritize selected text when available, ensuring users can summarize exactly the content they want without content extraction failures. Additionally, when no text is selected, the summarization would target the specific HTML element where the context menu was triggered (such as an article body, comment, or content block) rather than attempting to parse the entire page. This would significantly reduce instances where the summarizer extracts irrelevant content like navigation menus, sidebars, or advertisements, leading to more accurate and useful summaries while maintaining the existing workflow.
Users would benefit from this feature in several scenarios:
Selected Text Summarization: User highlights a long research paper abstract or article section, right-clicks, and selects "Kagi Summarize" to get a summary of only that selected content - completely eliminating content extraction errors.
Targeted Element Summarization: On a news website, user right-clicks within the main article content area (not on selected text) and the summarizer intelligently targets that specific article container rather than the entire page, avoiding sidebar content or comments.
Complex Page Navigation: On forums or social media, user right-clicks on a specific long comment or post, and the summarizer focuses on that individual content block rather than the entire thread.
Implementation Examples:
Browser translation extensions: Many offer both selected text translation and element-based translation depending on context
Text-to-speech extensions: Commonly support both selected text and intelligent content detection
Technical Approach: The extension would first check for selected text and prioritize it for summarization. If no text is selected, it would identify the closest meaningful HTML element (article, main, content containers) from the right-click location using the browser's context menu API and DOM traversal. This dual-mode approach would provide users with bulletproof accuracy for selected content while improving automatic detection for full-element summarization.