fix(web): dont collapse composer when interacting with bottom row (#9490)

This commit is contained in:
Exotic authored and GitHub committed 2026-09-03 15:23:01 -07:00
1 parent 0869ad648b
commit 77138cf331
7 files changed
+23 -7

No files matched your search

+2 -1
View File
@@ -40,6 +40,7 @@ import {
} from "./ui/menu";
import { Separator } from "./ui/separator";
import { ComposerSurface } from "./chat/ComposerSurface";
import { composerFloatingLayerProps } from "./chat/composerEventScope";
import { measureRestingComposerControls } from "./chat/restingComposerControlsMeasurement";
import { resolveRestingComposerControlsNaturalWidth } from "./composerFooterLayout";
import { cn } from "~/lib/utils";
@@ -160,7 +161,7 @@ const MobileRunContextSelector = memo(function MobileRunContextSelector({
{triggerContent}
<ChevronDownIcon className="size-3 shrink-0 opacity-50" />
</MenuTrigger>
<MenuPopup align="start" side="top" className="w-64">
<MenuPopup align="start" side="top" className="w-64" {...composerFloatingLayerProps}>
{showEnvironmentPicker && availableEnvironments && onEnvironmentChange ? (
<>
<MenuGroup>
@@ -34,6 +34,7 @@ import { vcsEnvironment } from "../state/vcs";
import { cn } from "../lib/utils";
import { parsePullRequestReference } from "../pullRequestReference";
import { getSourceControlPresentation } from "../sourceControlPresentation";
import { composerFloatingLayerProps } from "./chat/composerEventScope";
import {
deriveLocalBranchNameFromRemoteRef,
resolveBranchTriggerLabel,
@@ -788,7 +789,12 @@ export function BranchToolbarBranchSelector({
</ComboboxTrigger>
</span>
</div>
<ComboboxPopup align="end" side="top" className="flex w-80 flex-col">
<ComboboxPopup
align="end"
side="top"
className="flex w-80 flex-col"
{...composerFloatingLayerProps}
>
<div className="shrink-0 px-3 pt-2.5">
<div className="relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring">
<SearchIcon
@@ -7,6 +7,7 @@ import {
resolveLockedWorkspaceLabel,
type EnvMode,
} from "./BranchToolbar.logic";
import { composerFloatingLayerProps } from "./chat/composerEventScope";
import {
Select,
SelectGroup,
@@ -113,7 +114,7 @@ export const BranchToolbarEnvModeSelector = memo(function BranchToolbarEnvModeSe
</span>
</span>
</SelectTrigger>
<SelectPopup>
<SelectPopup {...composerFloatingLayerProps}>
<SelectGroup>
<SelectGroupLabel>Workspace</SelectGroupLabel>
<SelectItem value="local">
@@ -3,6 +3,7 @@ import { memo, useMemo } from "react";
import type { EnvironmentOption } from "./BranchToolbar.logic";
import { EnvironmentMachineIcon } from "./EnvironmentMachineIcon";
import { composerFloatingLayerProps } from "./chat/composerEventScope";
import {
Select,
SelectGroup,
@@ -101,7 +102,7 @@ export const BranchToolbarEnvironmentSelector = memo(function BranchToolbarEnvir
</span>
</span>
</SelectTrigger>
<SelectPopup>
<SelectPopup {...composerFloatingLayerProps}>
<SelectGroup>
<SelectGroupLabel>Run on</SelectGroupLabel>
{availableEnvironments.map((env) => (
@@ -4283,7 +4283,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
const composerSurface = composerSurfaceRef.current;
const composerForm = composerFormRef.current;
const activeElement = document.activeElement;
if (activeElement instanceof Element && isInsideComposerFloatingLayer(activeElement)) {
if (isInsideRestingComposerControlScope(activeElement)) {
return;
}
if (
@@ -4303,8 +4303,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
const isInsideDesktopComposerFocusScope = (target: EventTarget | null) =>
Boolean(
target instanceof Node &&
(composerFormRef.current?.contains(target) ||
(target instanceof Element && isInsideComposerFloatingLayer(target))),
(composerFormRef.current?.contains(target) || isInsideRestingComposerControlScope(target)),
);
const handleFocusIn = (event: FocusEvent) => {
if (!isInsideDesktopComposerFocusScope(event.target)) {
@@ -29,6 +29,13 @@ describe("composer event scopes", () => {
expect(isInsideRestingComposerControlScope(target as unknown as EventTarget)).toBe(true);
});
it("recognizes events from the composer context strip controls", () => {
vi.stubGlobal("Element", FakeElement);
const target = new FakeElement("[data-composer-context-control]");
expect(isInsideRestingComposerControlScope(target as unknown as EventTarget)).toBe(true);
});
it("keeps resting image previews focused without expanding their subtree", () => {
vi.stubGlobal("Element", FakeElement);
@@ -26,6 +26,7 @@ export function isInsideRestingComposerControlScope(target: EventTarget | null):
target instanceof Element &&
(target.closest('[data-chat-composer-resting-controls="true"]') !== null ||
target.closest('[data-chat-composer-resting-images="true"]') !== null ||
target.closest("[data-composer-context-control]") !== null ||
isInsideComposerFloatingLayer(target))
);
}