-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Reapply "Always focus the panel when clicked to ensure menu buttons are visible" #4598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mrubens
merged 4 commits into
RooCodeInc:main
from
hassoncs:revert-revert-fix-missing-icons-popout-view
Jun 17, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cf5f65f
Reapply "Always focus the panel when clicked to ensure menu buttons a…
hassoncs 1e80a04
Expands non-interactive click detection to include VSCode elements
hassoncs eb74c91
feat: Enhance focus behavior for WebView based on render context
daniel-lxs aa498c2
Merge branch 'main' into revert-revert-fix-missing-icons-popout-view
mrubens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "roo-cline": patch | ||
| --- | ||
|
|
||
| Always focus the panel when clicked to ensure menu buttons are available |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import * as vscode from "vscode" | ||
| import { Package } from "../shared/package" | ||
| import { ClineProvider } from "../core/webview/ClineProvider" | ||
|
|
||
| /** | ||
| * Focus the active panel (either tab or sidebar) | ||
| * @param tabPanel - The tab panel reference | ||
| * @param sidebarPanel - The sidebar panel reference | ||
| * @returns Promise that resolves when focus is complete | ||
| */ | ||
| export async function focusPanel( | ||
| tabPanel: vscode.WebviewPanel | undefined, | ||
| sidebarPanel: vscode.WebviewView | undefined, | ||
| ): Promise<void> { | ||
| const panel = tabPanel || sidebarPanel | ||
|
|
||
| if (!panel) { | ||
| // If no panel is open, open the sidebar | ||
| await vscode.commands.executeCommand(`workbench.view.extension.${Package.name}-ActivityBar`) | ||
| } else if (panel === tabPanel && !panel.active) { | ||
| // For tab panels, use reveal to focus | ||
| panel.reveal(vscode.ViewColumn.Active, false) | ||
| } else if (panel === sidebarPanel) { | ||
| // For sidebar panels, focus the sidebar | ||
| await vscode.commands.executeCommand(`${ClineProvider.sideBarId}.focus`) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| export * from "./useClipboard" | ||
| export * from "./useRooPortal" | ||
| export * from "./useNonInteractiveClick" |
36 changes: 36 additions & 0 deletions
36
webview-ui/src/components/ui/hooks/useNonInteractiveClick.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { useEffect } from "react" | ||
|
|
||
| /** | ||
| * Hook that listens for clicks on non-interactive elements and calls the provided handler. | ||
| * | ||
| * Interactive elements (inputs, textareas, selects, contentEditable) are excluded | ||
| * to avoid disrupting user typing or form interactions. | ||
| * | ||
| * @param handler - Function to call when a non-interactive element is clicked | ||
| */ | ||
| export function useAddNonInteractiveClickListener(handler: () => void) { | ||
| useEffect(() => { | ||
| const handleContentClick = (e: MouseEvent) => { | ||
| const target = e.target as HTMLElement | ||
|
|
||
| // Don't trigger for input elements to avoid disrupting typing | ||
| if ( | ||
| target.tagName !== "INPUT" && | ||
| target.tagName !== "SELECT" && | ||
| target.tagName !== "TEXTAREA" && | ||
| target.tagName !== "VSCODE-TEXT-AREA" && | ||
| target.tagName !== "VSCODE-TEXT-FIELD" && | ||
|
Comment on lines
+21
to
+22
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was missing these before which caused the revert |
||
| !target.isContentEditable | ||
| ) { | ||
| handler() | ||
| } | ||
| } | ||
|
|
||
| // Add listener to the document body to handle all clicks | ||
| document.body.addEventListener("click", handleContentClick) | ||
|
|
||
| return () => { | ||
| document.body.removeEventListener("click", handleContentClick) | ||
| } | ||
| }, [handler]) | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is unrelated but the linter does it automatically