Skip to content

Refactor tool pill styling and add cicada explorer support#46

Closed
wende wants to merge 4 commits into
8clawfrom
codex/remove-tool-call-borders-and
Closed

Refactor tool pill styling and add cicada explorer support#46
wende wants to merge 4 commits into
8clawfrom
codex/remove-tool-call-borders-and

Conversation

@wende

@wende wende commented Mar 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • refine tool pill presentation and interaction in chat rows, including expansion styling, chevron behavior, and result display
  • add targeted coverage for tool pill interactions and related message row behavior
  • introduce the cicada explorer page, graph data/types, and supporting tests

Testing

  • pnpm test tests/ToolCallPill.test.tsx
  • pnpm test tests/MessageRow.test.tsx

@vercel

vercel Bot commented Mar 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mobileclaw Ready Ready Preview, Comment Mar 23, 2026 7:44pm

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the user interface and interaction of tool call pills within chat rows. It focuses on modernizing their visual presentation, improving the expand/collapse functionality for better readability, and adding robust event handling to create a more intuitive and accessible user experience. The changes are supported by new unit tests to validate the updated UI interactions.

Highlights

  • Tool Pill Styling and Interaction Refinement: Refined the visual presentation and interaction of tool call pills, including their expansion/collapse behavior, chevron icons, and the display of results. This involved updating CSS properties and removing unused styling constants.
  • Enhanced Accessibility and User Experience: Improved the user experience for tool call pills by implementing robust event handling for keyboard, mouse, and touch interactions. New logic prevents unintended collapse when text is selected within an expanded pill, and a dedicated collapse button was added for expanded states.
  • New Test Coverage for Tool Pill Interactions: Introduced a new test file specifically for ToolCallPill to ensure the correct and expected collapse behavior, particularly in scenarios involving text selection.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 2 issues, and left some high level feedback:

  • The new getToolBubbleStyle and BottomChevronButton rely on hard-coded colors (#FAFAFA, #E0E0E0) instead of design tokens, which will likely break dark mode/theming; consider switching these to existing theme variables or CSS classes used elsewhere for borders and backgrounds.
  • Both the header and expanded content sections in ToolCallPill now use handleToggleMouseUp, which means clicking anywhere in the expanded result/args area will collapse the pill; if the intent is to only toggle from the header or chevron, limit the toggle handler to that region so users can interact with content without accidentally collapsing it.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `getToolBubbleStyle` and `BottomChevronButton` rely on hard-coded colors (`#FAFAFA`, `#E0E0E0`) instead of design tokens, which will likely break dark mode/theming; consider switching these to existing theme variables or CSS classes used elsewhere for borders and backgrounds.
- Both the header and expanded content sections in `ToolCallPill` now use `handleToggleMouseUp`, which means clicking anywhere in the expanded result/args area will collapse the pill; if the intent is to only toggle from the header or chevron, limit the toggle handler to that region so users can interact with content without accidentally collapsing it.

## Individual Comments

### Comment 1
<location path="components/ToolCallPill.tsx" line_range="148-151" />
<code_context>
+  );
+}
+
+function hasSelectedText() {
+  if (typeof window === "undefined" || typeof window.getSelection !== "function") return false;
+  const selection = window.getSelection();
+  return !!selection && !selection.isCollapsed && selection.toString().trim().length > 0;
+}
+
</code_context>
<issue_to_address>
**issue (bug_risk):** Using global window selection to gate toggling can cause unexpected behavior when text is selected elsewhere on the page.

`hasSelectedText` uses `window.getSelection()` globally, so any non-collapsed selection anywhere on the page blocks pill toggling. This means selecting text elsewhere in the UI will prevent expand/collapse until the selection is cleared.

Consider scoping the check to the pill by passing the event/currentTarget into the helper and inspecting selection ranges (e.g., checking whether `range.commonAncestorContainer` or its parent is within the pill node). This keeps the behavior local to text selected inside the pill only.
</issue_to_address>

### Comment 2
<location path="components/ToolCallPill.tsx" line_range="207-216" />
<code_context>
     <div
       ref={scrollContainerRef}
       onScroll={handleScroll}
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Spawn pill `aria-expanded` may not accurately reflect the internal `open` state when the pill is pinned.

Because `aria-expanded` is tied to `open && !isPinned`, a pinned pill can still toggle its internal `open` state without any visual change or ARIA update. This desynchronizes user interaction, visual state, and accessibility state. Consider either preventing toggling while pinned (removing the `onKeyDown`/`onMouseUp`/`onTouchEnd` handlers) or updating both the rendered content and `aria-expanded` so they remain consistent when pinned.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread components/ToolCallPill.tsx Outdated
Comment thread components/ToolCallPill.tsx

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request refactors the ToolCallPill and SpawnPill components to enhance their expand/collapse functionality and styling. Key changes include updating bubble styling logic, introducing new event handlers for keyboard, mouse, and touch interactions, and adding a BottomChevronButton for collapsing. Several hardcoded styling constants and related CSS classes were removed. A new test file was added for ToolCallPill to cover the new collapse behavior. The review comments suggest replacing hardcoded border and background colors with CSS variables for improved theming and maintainability.

Comment thread components/ToolCallPill.tsx Outdated
Comment on lines +55 to +56
borderTop: expanded ? "1px solid #E0E0E0" : "none",
borderBottom: expanded ? "1px solid #E0E0E0" : "none",

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.

medium

The border color #E0E0E0 is hardcoded. To improve theming and maintainability, it's better to use a CSS variable from your design system. This will ensure the component adapts correctly to different themes, such as dark mode. Using a variable like hsl(var(--border)) would be consistent with Tailwind CSS conventions.

Suggested change
borderTop: expanded ? "1px solid #E0E0E0" : "none",
borderBottom: expanded ? "1px solid #E0E0E0" : "none",
borderTop: expanded ? "1px solid hsl(var(--border))" : "none",
borderBottom: expanded ? "1px solid hsl(var(--border))" : "none",

Comment thread components/ToolCallPill.tsx Outdated
aria-label={label}
onClick={onToggle}
className="absolute left-1/2 z-10 flex h-5 w-16 -translate-x-1/2 cursor-pointer items-center justify-center text-foreground/45"
style={{ background: "#FAFAFA", bottom: "-0.625rem" }}

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.

medium

The background color #FAFAFA is hardcoded. This will not adapt to different themes (e.g., dark mode). Please use a CSS variable from your design system, for example hsl(var(--background)) or a more specific one for card backgrounds.

Suggested change
style={{ background: "#FAFAFA", bottom: "-0.625rem" }}
style={{ background: "hsl(var(--background))", bottom: "-0.625rem" }}

@wende wende changed the base branch from main to 8claw March 23, 2026 19:15
@wende

wende commented Mar 23, 2026

Copy link
Copy Markdown
Owner Author

Merged manually

@wende wende closed this Mar 23, 2026
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