Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add comment button to toolbar that enters prompt mode on next element click - Add pendingCommentMode state to store - Add isCommentMode and onComment props to toolbar and renderer - Extract common toolbar button handlers (stopEventPropagation, createFreezeHandlers) - Replace nested ternaries with getToolbarIconColor helper function - Fix overflow class inconsistency in toolbar-content.tsx - Remove unused formatShortcut import
0f08486 to
6657d9b
Compare
There was a problem hiding this comment.
Found several issues with the comment mode implementation: incorrect callback usage in freeze handlers causing wrong hover state tracking, missing condition check that breaks unfreezing behavior, and a UX issue with mode switching. All issues are in toolbar/index.tsx.
| const createFreezeHandlers = ( | ||
| setTooltipVisible: (visible: boolean) => void, | ||
| ) => ({ | ||
| onMouseEnter: () => { | ||
| setTooltipVisible(true); | ||
| props.onSelectHoverChange?.(true); | ||
| if (!unfreezeUpdatesCallback) { | ||
| unfreezeUpdatesCallback = freezeUpdates(); | ||
| freezeGlobalAnimations(); | ||
| freezePseudoStates(); | ||
| } | ||
| }, | ||
| onMouseLeave: () => { | ||
| setTooltipVisible(false); | ||
| props.onSelectHoverChange?.(false); | ||
| if (!props.isActive && !props.isContextMenuOpen) { | ||
| unfreezeUpdatesCallback?.(); | ||
| unfreezeUpdatesCallback = null; | ||
| unfreezeGlobalAnimations(); | ||
| unfreezePseudoStates(); | ||
| } | ||
| }, | ||
| }); |
There was a problem hiding this comment.
Bug: createFreezeHandlers always calls props.onSelectHoverChange regardless of which button uses it. The comment button (line 1087) incorrectly triggers select hover callbacks.
This should accept an optional parameter to control whether to call the hover change callback:
const createFreezeHandlers = (
setTooltipVisible: (visible: boolean) => void,
shouldNotifyHoverChange = false,
) => ({
onMouseEnter: () => {
setTooltipVisible(true);
if (shouldNotifyHoverChange) {
props.onSelectHoverChange?.(true);
}
// ...
},
onMouseLeave: () => {
setTooltipVisible(false);
if (shouldNotifyHoverChange) {
props.onSelectHoverChange?.(false);
}
// ...
},
});Then call it with createFreezeHandlers(setIsSelectTooltipVisible, true) for select button and createFreezeHandlers(setIsCommentTooltipVisible, false) for comment button.
| onMouseLeave: () => { | ||
| setTooltipVisible(false); | ||
| props.onSelectHoverChange?.(false); | ||
| if (!props.isActive && !props.isContextMenuOpen) { |
There was a problem hiding this comment.
Bug: Unfreeze condition is incomplete. When hovering over the comment button while in pending comment mode (props.isCommentMode is true), the onMouseLeave will not properly unfreeze because the condition doesn't check !props.isCommentMode.
Should be: if (!props.isActive && !props.isContextMenuOpen && !props.isCommentMode)
| const handleComment = () => { | ||
| if (isActivated()) { | ||
| deactivateRenderer(); | ||
| } else if (isEnabled()) { | ||
| actions.setPendingCommentMode(true); | ||
| toggleActivate(); | ||
| } | ||
| }; |
There was a problem hiding this comment.
UX consideration: When already in select mode (isActivated() is true) and clicking the comment button, this just deactivates instead of switching to comment mode. This means users need to click comment twice to enter comment mode from select mode.
Consider this alternative behavior:
const handleComment = () => {
if (isActivated()) {
if (store.pendingCommentMode || isPromptMode()) {
// Already in comment mode, deactivate
deactivateRenderer();
} else {
// In select mode, switch to comment mode
actions.setPendingCommentMode(true);
}
} else if (isEnabled()) {
actions.setPendingCommentMode(true);
toggleActivate();
}
};This allows toggling between select and comment modes without fully deactivating.
@react-grab/cli
grab
@react-grab/ami
@react-grab/amp
@react-grab/claude-code
@react-grab/codex
@react-grab/cursor
@react-grab/droid
@react-grab/gemini
@react-grab/opencode
react-grab
@react-grab/relay
commit: |
There was a problem hiding this comment.
1 issue found across 10 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/react-grab/src/core/index.tsx">
<violation number="1" location="packages/react-grab/src/core/index.tsx:1463">
P2: The current implementation deactivates the renderer when clicking the comment button if the tool is already active. This forces users to double-click (deactivate then re-activate) to switch from selection mode to comment mode.
Consider checking if `pendingCommentMode` is active:
- If yes (already in comment mode), deactivate (toggle off).
- If no (in selection mode), switch to comment mode (set pending flag) without deactivating.
(Note: A similar logic update should likely be applied to `handleToggleActive` to allow switching back to selection mode without deactivating.)</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
Bugbot Autofix prepared fixes for 1 of the 1 bugs found in the latest run.
|
- Refactor comment mode handling in the toolbar and renderer - Update state management for pendingCommentMode and isCommentMode - Improve element interaction logic for entering comment mode - Ensure proper activation and deactivation of comment mode based on user actions
- Add isToolbarCommentMode and isToolbarCollapsed props to the design system - Update toolbar content to utilize new props for improved state management - Refactor button rendering logic in toolbar-content.tsx to accommodate comment mode and active states
- Remove premature setPendingCommentMode(false) in handleDragSelection to allow comment mode for drag selections - Add isCommentMode prop to ToolbarContentProps and apply conditional styling to defaultCommentButton
- Remove premature setPendingCommentMode(false) in handleDragSelection to allow comment mode for drag selections - Add isCommentMode prop to ToolbarContentProps and apply conditional styling to defaultCommentButton using getIconColor helper
|
Bugbot Autofix prepared fixes for 2 of the 2 bugs found in the latest run.
|
… helper - Fix comment icon toggle behavior to check isCommentMode() instead of just pendingCommentMode, ensuring visual state matches click behavior - Extract getToolbarIconColor to shared utility to eliminate code duplication between toolbar files
|
Bugbot Autofix prepared fixes for 2 of the 2 bugs found in the latest run.
|
|
Bugbot Autofix prepared fixes for 1 of the 1 bugs found in the latest run.
|
* feat: add comment mode to toolbar - Add comment button to toolbar that enters prompt mode on next element click - Add pendingCommentMode state to store - Add isCommentMode and onComment props to toolbar and renderer - Extract common toolbar button handlers (stopEventPropagation, createFreezeHandlers) - Replace nested ternaries with getToolbarIconColor helper function - Fix overflow class inconsistency in toolbar-content.tsx - Remove unused formatShortcut import * chore: update version in manifest.json to 0.0.7 * fix: clear pendingCommentMode on drag selection to prevent unexpected prompt mode * feat: enhance comment mode functionality - Refactor comment mode handling in the toolbar and renderer - Update state management for pendingCommentMode and isCommentMode - Improve element interaction logic for entering comment mode - Ensure proper activation and deactivation of comment mode based on user actions * feat: enhance toolbar functionality with new props - Add isToolbarCommentMode and isToolbarCollapsed props to the design system - Update toolbar content to utilize new props for improved state management - Refactor button rendering logic in toolbar-content.tsx to accommodate comment mode and active states * fix: comment mode drag selection and toolbar button styling - Remove premature setPendingCommentMode(false) in handleDragSelection to allow comment mode for drag selections - Add isCommentMode prop to ToolbarContentProps and apply conditional styling to defaultCommentButton * Fix comment icon state inconsistency and extract duplicate icon color helper - Fix comment icon toggle behavior to check isCommentMode() instead of just pendingCommentMode, ensuring visual state matches click behavior - Extract getToolbarIconColor to shared utility to eliminate code duplication between toolbar files * fix: rename confusing isActive parameter to isDimmed in getToolbarIconColor --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* feat: add comment mode to toolbar - Add comment button to toolbar that enters prompt mode on next element click - Add pendingCommentMode state to store - Add isCommentMode and onComment props to toolbar and renderer - Extract common toolbar button handlers (stopEventPropagation, createFreezeHandlers) - Replace nested ternaries with getToolbarIconColor helper function - Fix overflow class inconsistency in toolbar-content.tsx - Remove unused formatShortcut import * chore: update version in manifest.json to 0.0.7 * fix: clear pendingCommentMode on drag selection to prevent unexpected prompt mode * feat: enhance comment mode functionality - Refactor comment mode handling in the toolbar and renderer - Update state management for pendingCommentMode and isCommentMode - Improve element interaction logic for entering comment mode - Ensure proper activation and deactivation of comment mode based on user actions * feat: enhance toolbar functionality with new props - Add isToolbarCommentMode and isToolbarCollapsed props to the design system - Update toolbar content to utilize new props for improved state management - Refactor button rendering logic in toolbar-content.tsx to accommodate comment mode and active states * fix: comment mode drag selection and toolbar button styling - Remove premature setPendingCommentMode(false) in handleDragSelection to allow comment mode for drag selections - Add isCommentMode prop to ToolbarContentProps and apply conditional styling to defaultCommentButton * Fix comment icon state inconsistency and extract duplicate icon color helper - Fix comment icon toggle behavior to check isCommentMode() instead of just pendingCommentMode, ensuring visual state matches click behavior - Extract getToolbarIconColor to shared utility to eliminate code duplication between toolbar files * fix: rename confusing isActive parameter to isDimmed in getToolbarIconColor --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* feat: add comment mode to toolbar - Add comment button to toolbar that enters prompt mode on next element click - Add pendingCommentMode state to store - Add isCommentMode and onComment props to toolbar and renderer - Extract common toolbar button handlers (stopEventPropagation, createFreezeHandlers) - Replace nested ternaries with getToolbarIconColor helper function - Fix overflow class inconsistency in toolbar-content.tsx - Remove unused formatShortcut import * chore: update version in manifest.json to 0.0.7 * fix: clear pendingCommentMode on drag selection to prevent unexpected prompt mode * feat: enhance comment mode functionality - Refactor comment mode handling in the toolbar and renderer - Update state management for pendingCommentMode and isCommentMode - Improve element interaction logic for entering comment mode - Ensure proper activation and deactivation of comment mode based on user actions * feat: enhance toolbar functionality with new props - Add isToolbarCommentMode and isToolbarCollapsed props to the design system - Update toolbar content to utilize new props for improved state management - Refactor button rendering logic in toolbar-content.tsx to accommodate comment mode and active states * fix: comment mode drag selection and toolbar button styling - Remove premature setPendingCommentMode(false) in handleDragSelection to allow comment mode for drag selections - Add isCommentMode prop to ToolbarContentProps and apply conditional styling to defaultCommentButton * Fix comment icon state inconsistency and extract duplicate icon color helper - Fix comment icon toggle behavior to check isCommentMode() instead of just pendingCommentMode, ensuring visual state matches click behavior - Extract getToolbarIconColor to shared utility to eliminate code duplication between toolbar files * fix: rename confusing isActive parameter to isDimmed in getToolbarIconColor --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* feat: add comment mode to toolbar - Add comment button to toolbar that enters prompt mode on next element click - Add pendingCommentMode state to store - Add isCommentMode and onComment props to toolbar and renderer - Extract common toolbar button handlers (stopEventPropagation, createFreezeHandlers) - Replace nested ternaries with getToolbarIconColor helper function - Fix overflow class inconsistency in toolbar-content.tsx - Remove unused formatShortcut import * chore: update version in manifest.json to 0.0.7 * fix: clear pendingCommentMode on drag selection to prevent unexpected prompt mode * feat: enhance comment mode functionality - Refactor comment mode handling in the toolbar and renderer - Update state management for pendingCommentMode and isCommentMode - Improve element interaction logic for entering comment mode - Ensure proper activation and deactivation of comment mode based on user actions * feat: enhance toolbar functionality with new props - Add isToolbarCommentMode and isToolbarCollapsed props to the design system - Update toolbar content to utilize new props for improved state management - Refactor button rendering logic in toolbar-content.tsx to accommodate comment mode and active states * fix: comment mode drag selection and toolbar button styling - Remove premature setPendingCommentMode(false) in handleDragSelection to allow comment mode for drag selections - Add isCommentMode prop to ToolbarContentProps and apply conditional styling to defaultCommentButton * Fix comment icon state inconsistency and extract duplicate icon color helper - Fix comment icon toggle behavior to check isCommentMode() instead of just pendingCommentMode, ensuring visual state matches click behavior - Extract getToolbarIconColor to shared utility to eliminate code duplication between toolbar files * fix: rename confusing isActive parameter to isDimmed in getToolbarIconColor --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* feat: add comment mode to toolbar - Add comment button to toolbar that enters prompt mode on next element click - Add pendingCommentMode state to store - Add isCommentMode and onComment props to toolbar and renderer - Extract common toolbar button handlers (stopEventPropagation, createFreezeHandlers) - Replace nested ternaries with getToolbarIconColor helper function - Fix overflow class inconsistency in toolbar-content.tsx - Remove unused formatShortcut import * chore: update version in manifest.json to 0.0.7 * fix: clear pendingCommentMode on drag selection to prevent unexpected prompt mode * feat: enhance comment mode functionality - Refactor comment mode handling in the toolbar and renderer - Update state management for pendingCommentMode and isCommentMode - Improve element interaction logic for entering comment mode - Ensure proper activation and deactivation of comment mode based on user actions * feat: enhance toolbar functionality with new props - Add isToolbarCommentMode and isToolbarCollapsed props to the design system - Update toolbar content to utilize new props for improved state management - Refactor button rendering logic in toolbar-content.tsx to accommodate comment mode and active states * fix: comment mode drag selection and toolbar button styling - Remove premature setPendingCommentMode(false) in handleDragSelection to allow comment mode for drag selections - Add isCommentMode prop to ToolbarContentProps and apply conditional styling to defaultCommentButton * Fix comment icon state inconsistency and extract duplicate icon color helper - Fix comment icon toggle behavior to check isCommentMode() instead of just pendingCommentMode, ensuring visual state matches click behavior - Extract getToolbarIconColor to shared utility to eliminate code duplication between toolbar files * fix: rename confusing isActive parameter to isDimmed in getToolbarIconColor --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* feat: add comment mode to toolbar - Add comment button to toolbar that enters prompt mode on next element click - Add pendingCommentMode state to store - Add isCommentMode and onComment props to toolbar and renderer - Extract common toolbar button handlers (stopEventPropagation, createFreezeHandlers) - Replace nested ternaries with getToolbarIconColor helper function - Fix overflow class inconsistency in toolbar-content.tsx - Remove unused formatShortcut import * chore: update version in manifest.json to 0.0.7 * fix: clear pendingCommentMode on drag selection to prevent unexpected prompt mode * feat: enhance comment mode functionality - Refactor comment mode handling in the toolbar and renderer - Update state management for pendingCommentMode and isCommentMode - Improve element interaction logic for entering comment mode - Ensure proper activation and deactivation of comment mode based on user actions * feat: enhance toolbar functionality with new props - Add isToolbarCommentMode and isToolbarCollapsed props to the design system - Update toolbar content to utilize new props for improved state management - Refactor button rendering logic in toolbar-content.tsx to accommodate comment mode and active states * fix: comment mode drag selection and toolbar button styling - Remove premature setPendingCommentMode(false) in handleDragSelection to allow comment mode for drag selections - Add isCommentMode prop to ToolbarContentProps and apply conditional styling to defaultCommentButton * Fix comment icon state inconsistency and extract duplicate icon color helper - Fix comment icon toggle behavior to check isCommentMode() instead of just pendingCommentMode, ensuring visual state matches click behavior - Extract getToolbarIconColor to shared utility to eliminate code duplication between toolbar files * fix: rename confusing isActive parameter to isDimmed in getToolbarIconColor --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* feat: add comment mode to toolbar - Add comment button to toolbar that enters prompt mode on next element click - Add pendingCommentMode state to store - Add isCommentMode and onComment props to toolbar and renderer - Extract common toolbar button handlers (stopEventPropagation, createFreezeHandlers) - Replace nested ternaries with getToolbarIconColor helper function - Fix overflow class inconsistency in toolbar-content.tsx - Remove unused formatShortcut import * chore: update version in manifest.json to 0.0.7 * fix: clear pendingCommentMode on drag selection to prevent unexpected prompt mode * feat: enhance comment mode functionality - Refactor comment mode handling in the toolbar and renderer - Update state management for pendingCommentMode and isCommentMode - Improve element interaction logic for entering comment mode - Ensure proper activation and deactivation of comment mode based on user actions * feat: enhance toolbar functionality with new props - Add isToolbarCommentMode and isToolbarCollapsed props to the design system - Update toolbar content to utilize new props for improved state management - Refactor button rendering logic in toolbar-content.tsx to accommodate comment mode and active states * fix: comment mode drag selection and toolbar button styling - Remove premature setPendingCommentMode(false) in handleDragSelection to allow comment mode for drag selections - Add isCommentMode prop to ToolbarContentProps and apply conditional styling to defaultCommentButton * Fix comment icon state inconsistency and extract duplicate icon color helper - Fix comment icon toggle behavior to check isCommentMode() instead of just pendingCommentMode, ensuring visual state matches click behavior - Extract getToolbarIconColor to shared utility to eliminate code duplication between toolbar files * fix: rename confusing isActive parameter to isDimmed in getToolbarIconColor --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* feat: add comment mode to toolbar - Add comment button to toolbar that enters prompt mode on next element click - Add pendingCommentMode state to store - Add isCommentMode and onComment props to toolbar and renderer - Extract common toolbar button handlers (stopEventPropagation, createFreezeHandlers) - Replace nested ternaries with getToolbarIconColor helper function - Fix overflow class inconsistency in toolbar-content.tsx - Remove unused formatShortcut import * chore: update version in manifest.json to 0.0.7 * fix: clear pendingCommentMode on drag selection to prevent unexpected prompt mode * feat: enhance comment mode functionality - Refactor comment mode handling in the toolbar and renderer - Update state management for pendingCommentMode and isCommentMode - Improve element interaction logic for entering comment mode - Ensure proper activation and deactivation of comment mode based on user actions * feat: enhance toolbar functionality with new props - Add isToolbarCommentMode and isToolbarCollapsed props to the design system - Update toolbar content to utilize new props for improved state management - Refactor button rendering logic in toolbar-content.tsx to accommodate comment mode and active states * fix: comment mode drag selection and toolbar button styling - Remove premature setPendingCommentMode(false) in handleDragSelection to allow comment mode for drag selections - Add isCommentMode prop to ToolbarContentProps and apply conditional styling to defaultCommentButton * Fix comment icon state inconsistency and extract duplicate icon color helper - Fix comment icon toggle behavior to check isCommentMode() instead of just pendingCommentMode, ensuring visual state matches click behavior - Extract getToolbarIconColor to shared utility to eliminate code duplication between toolbar files * fix: rename confusing isActive parameter to isDimmed in getToolbarIconColor --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* feat: add comment mode to toolbar - Add comment button to toolbar that enters prompt mode on next element click - Add pendingCommentMode state to store - Add isCommentMode and onComment props to toolbar and renderer - Extract common toolbar button handlers (stopEventPropagation, createFreezeHandlers) - Replace nested ternaries with getToolbarIconColor helper function - Fix overflow class inconsistency in toolbar-content.tsx - Remove unused formatShortcut import * chore: update version in manifest.json to 0.0.7 * fix: clear pendingCommentMode on drag selection to prevent unexpected prompt mode * feat: enhance comment mode functionality - Refactor comment mode handling in the toolbar and renderer - Update state management for pendingCommentMode and isCommentMode - Improve element interaction logic for entering comment mode - Ensure proper activation and deactivation of comment mode based on user actions * feat: enhance toolbar functionality with new props - Add isToolbarCommentMode and isToolbarCollapsed props to the design system - Update toolbar content to utilize new props for improved state management - Refactor button rendering logic in toolbar-content.tsx to accommodate comment mode and active states * fix: comment mode drag selection and toolbar button styling - Remove premature setPendingCommentMode(false) in handleDragSelection to allow comment mode for drag selections - Add isCommentMode prop to ToolbarContentProps and apply conditional styling to defaultCommentButton * Fix comment icon state inconsistency and extract duplicate icon color helper - Fix comment icon toggle behavior to check isCommentMode() instead of just pendingCommentMode, ensuring visual state matches click behavior - Extract getToolbarIconColor to shared utility to eliminate code duplication between toolbar files * fix: rename confusing isActive parameter to isDimmed in getToolbarIconColor --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>

Summary
pendingCommentModestate to track when comment mode is pendingChanges
New Feature
Refactoring (deslop)
stopEventPropagationhandler for reuse across toolbar buttonscreateFreezeHandlersto consolidate mouse enter/leave freeze logicgetToolbarIconColorhelper functionoverflow-hidden→overflow-visibleinconsistency in toolbar-content.tsxformatShortcutimportTest plan
Note
Medium Risk
Adds a new interaction mode that changes the selection/click/drag flow into prompt mode; risk is mainly behavioral regressions around activation/deactivation and element selection handling.
Overview
Adds a Comment button to the overlay toolbar that toggles a one-shot “comment mode”: clicking it arms the next element click or drag-selection to enter prompt mode (loading cached input) instead of copying, and clicking Comment again exits/deactivates.
Threads
isCommentMode/onCommentthrough renderer/types, introducespendingCommentModein the core store (reset on deactivate), and updates click/drag handlers to branch intoenterPromptModewhen armed. UI updates include a newIconComment, shared hover/freeze handlers in the toolbar, centralized icon color logic viagetToolbarIconColor, and a design-system scenario for comment mode; the web extension manifest version is bumped to0.0.7.Written by Cursor Bugbot for commit f2aa1f3. This will update automatically on new commits. Configure here.
Summary by cubic
Adds a Comment mode to the toolbar. Clicking Comment arms the next element click or drag selection to open prompt mode at that position, loading cached input with clear icon states.
New Features
Refactors
Written for commit f2aa1f3. Summary will update on new commits.