Skip to content

Commit 3bb2be6

Browse files
Merge branch 'main' into fix/windows-native-process-snapshot
2 parents 24ff64e + 77138cf commit 3bb2be6

10 files changed

Lines changed: 144 additions & 81 deletions

‎apps/desktop/src/preview/AnnotationStyles.generated.ts‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎apps/web/src/components/BranchToolbar.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import {
4040
} from "./ui/menu";
4141
import { Separator } from "./ui/separator";
4242
import { ComposerSurface } from "./chat/ComposerSurface";
43+
import { composerFloatingLayerProps } from "./chat/composerEventScope";
4344
import { measureRestingComposerControls } from "./chat/restingComposerControlsMeasurement";
4445
import { resolveRestingComposerControlsNaturalWidth } from "./composerFooterLayout";
4546
import { cn } from "~/lib/utils";
@@ -160,7 +161,7 @@ const MobileRunContextSelector = memo(function MobileRunContextSelector({
160161
{triggerContent}
161162
<ChevronDownIcon className="size-3 shrink-0 opacity-50" />
162163
</MenuTrigger>
163-
<MenuPopup align="start" side="top" className="w-64">
164+
<MenuPopup align="start" side="top" className="w-64" {...composerFloatingLayerProps}>
164165
{showEnvironmentPicker && availableEnvironments && onEnvironmentChange ? (
165166
<>
166167
<MenuGroup>

‎apps/web/src/components/BranchToolbarBranchSelector.tsx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { vcsEnvironment } from "../state/vcs";
3434
import { cn } from "../lib/utils";
3535
import { parsePullRequestReference } from "../pullRequestReference";
3636
import { getSourceControlPresentation } from "../sourceControlPresentation";
37+
import { composerFloatingLayerProps } from "./chat/composerEventScope";
3738
import {
3839
deriveLocalBranchNameFromRemoteRef,
3940
resolveBranchTriggerLabel,
@@ -788,7 +789,12 @@ export function BranchToolbarBranchSelector({
788789
</ComboboxTrigger>
789790
</span>
790791
</div>
791-
<ComboboxPopup align="end" side="top" className="flex w-80 flex-col">
792+
<ComboboxPopup
793+
align="end"
794+
side="top"
795+
className="flex w-80 flex-col"
796+
{...composerFloatingLayerProps}
797+
>
792798
<div className="shrink-0 px-3 pt-2.5">
793799
<div className="relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring">
794800
<SearchIcon

‎apps/web/src/components/BranchToolbarEnvModeSelector.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
resolveLockedWorkspaceLabel,
88
type EnvMode,
99
} from "./BranchToolbar.logic";
10+
import { composerFloatingLayerProps } from "./chat/composerEventScope";
1011
import {
1112
Select,
1213
SelectGroup,
@@ -113,7 +114,7 @@ export const BranchToolbarEnvModeSelector = memo(function BranchToolbarEnvModeSe
113114
</span>
114115
</span>
115116
</SelectTrigger>
116-
<SelectPopup>
117+
<SelectPopup {...composerFloatingLayerProps}>
117118
<SelectGroup>
118119
<SelectGroupLabel>Workspace</SelectGroupLabel>
119120
<SelectItem value="local">

‎apps/web/src/components/BranchToolbarEnvironmentSelector.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { memo, useMemo } from "react";
33

44
import type { EnvironmentOption } from "./BranchToolbar.logic";
55
import { EnvironmentMachineIcon } from "./EnvironmentMachineIcon";
6+
import { composerFloatingLayerProps } from "./chat/composerEventScope";
67
import {
78
Select,
89
SelectGroup,
@@ -101,7 +102,7 @@ export const BranchToolbarEnvironmentSelector = memo(function BranchToolbarEnvir
101102
</span>
102103
</span>
103104
</SelectTrigger>
104-
<SelectPopup>
105+
<SelectPopup {...composerFloatingLayerProps}>
105106
<SelectGroup>
106107
<SelectGroupLabel>Run on</SelectGroupLabel>
107108
{availableEnvironments.map((env) => (

‎apps/web/src/components/chat/ChatComposer.tsx‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4283,7 +4283,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
42834283
const composerSurface = composerSurfaceRef.current;
42844284
const composerForm = composerFormRef.current;
42854285
const activeElement = document.activeElement;
4286-
if (activeElement instanceof Element && isInsideComposerFloatingLayer(activeElement)) {
4286+
if (isInsideRestingComposerControlScope(activeElement)) {
42874287
return;
42884288
}
42894289
if (
@@ -4303,8 +4303,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
43034303
const isInsideDesktopComposerFocusScope = (target: EventTarget | null) =>
43044304
Boolean(
43054305
target instanceof Node &&
4306-
(composerFormRef.current?.contains(target) ||
4307-
(target instanceof Element && isInsideComposerFloatingLayer(target))),
4306+
(composerFormRef.current?.contains(target) || isInsideRestingComposerControlScope(target)),
43084307
);
43094308
const handleFocusIn = (event: FocusEvent) => {
43104309
if (!isInsideDesktopComposerFocusScope(event.target)) {

‎apps/web/src/components/chat/composerEventScope.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ describe("composer event scopes", () => {
2929
expect(isInsideRestingComposerControlScope(target as unknown as EventTarget)).toBe(true);
3030
});
3131

32+
it("recognizes events from the composer context strip controls", () => {
33+
vi.stubGlobal("Element", FakeElement);
34+
35+
const target = new FakeElement("[data-composer-context-control]");
36+
expect(isInsideRestingComposerControlScope(target as unknown as EventTarget)).toBe(true);
37+
});
38+
3239
it("keeps resting image previews focused without expanding their subtree", () => {
3340
vi.stubGlobal("Element", FakeElement);
3441

‎apps/web/src/components/chat/composerEventScope.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export function isInsideRestingComposerControlScope(target: EventTarget | null):
2626
target instanceof Element &&
2727
(target.closest('[data-chat-composer-resting-controls="true"]') !== null ||
2828
target.closest('[data-chat-composer-resting-images="true"]') !== null ||
29+
target.closest("[data-composer-context-control]") !== null ||
2930
isInsideComposerFloatingLayer(target))
3031
);
3132
}

‎apps/web/src/components/pullRequest/PullRequestCandidatePicker.tsx‎

Lines changed: 70 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@
22
* The menu shell the reviewer and label pickers share: an icon trigger, a search box, and a
33
* scrolling body that says when the list is loading, could not be read, is empty, or is not all
44
* of it. The rows and the words are the caller's; the frame is the same either way.
5+
*
6+
* The same combobox as the project and branch pickers, and dressed the same, rather than a menu:
7+
* a menu's typeahead claims every keypress to jump between rows, which a search box cannot share.
58
*/
9+
import { SearchIcon } from "lucide-react";
610
import type { ReactNode } from "react";
711

812
import { Button } from "../ui/button";
9-
import { Input } from "../ui/input";
10-
import { Menu, MenuItem, MenuPopup, MenuTrigger } from "../ui/menu";
13+
import {
14+
Combobox,
15+
ComboboxInput,
16+
ComboboxItem,
17+
ComboboxList,
18+
ComboboxPopup,
19+
ComboboxTrigger,
20+
} from "../ui/combobox";
1121
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
1222
import { PullRequestPeopleGhost } from "./PullRequestGhosts";
1323

@@ -78,27 +88,61 @@ export function PullRequestCandidatePicker<T>({
7888
);
7989
}
8090

91+
const keys = candidates.map(candidateKey);
92+
8193
return (
82-
<Menu open={open} onOpenChange={onOpenChange}>
83-
<MenuTrigger
94+
<Combobox
95+
items={keys}
96+
// The caller narrows the list, so the combobox does no filtering of its own.
97+
filteredItems={keys}
98+
filter={null}
99+
autoHighlight
100+
value={null}
101+
onValueChange={(key) => {
102+
const candidate = candidates.find((entry) => candidateKey(entry) === key);
103+
if (candidate) onSelect(candidate);
104+
}}
105+
open={open}
106+
onOpenChange={(nextOpen, details) => {
107+
// Stays open on a pick: a change is confirmed by the row's own check turning over, and a
108+
// second label or reviewer is usually wanted right after the first. Cancelled rather than
109+
// ignored, so the combobox also skips its own close work: freezing the query and returning
110+
// focus to the trigger, either of which would take the next keystroke away from the box.
111+
if (!nextOpen && details.reason === "item-press") {
112+
details.cancel();
113+
return;
114+
}
115+
onOpenChange(nextOpen);
116+
}}
117+
>
118+
<ComboboxTrigger
84119
render={
85120
<Button size="icon-xs" variant="ghost" aria-label={label}>
86121
{icon}
87122
</Button>
88123
}
89124
/>
90-
<MenuPopup align="start" side="bottom" className="w-72 p-0">
91-
<div className="border-b border-border/60 p-2">
92-
<Input
93-
autoFocus
94-
value={query}
95-
onChange={(event) => onQueryChange(event.currentTarget.value)}
96-
placeholder={searchLabel}
97-
aria-label={searchLabel}
98-
size="compact"
99-
/>
125+
<ComboboxPopup align="start" side="bottom" className="w-72">
126+
<div className="shrink-0 px-3 pt-2.5">
127+
<div className="relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring">
128+
<SearchIcon
129+
aria-hidden="true"
130+
className="pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55"
131+
/>
132+
<ComboboxInput
133+
aria-label={searchLabel}
134+
className="[&_input]:h-6.5 [&_input]:ps-5 [&_input]:font-sans [&_input]:leading-6.5"
135+
inputClassName="rounded-none bg-transparent text-sm"
136+
placeholder={searchLabel}
137+
showTrigger={false}
138+
size="sm"
139+
unstyled
140+
value={query}
141+
onChange={(event) => onQueryChange(event.target.value)}
142+
/>
143+
</div>
100144
</div>
101-
<div className="max-h-72 overflow-y-auto p-1">
145+
<ComboboxList className="max-h-72">
102146
{isPending ? (
103147
<PullRequestPeopleGhost rows={4} />
104148
) : error !== null ? (
@@ -110,27 +154,27 @@ export function PullRequestCandidatePicker<T>({
110154
{query.length > 0 ? noMatchLabel : emptyLabel}
111155
</p>
112156
) : (
113-
candidates.map((candidate) => (
114-
// Stays open on press: a change is confirmed by the row's own check turning over,
115-
// and a second label or reviewer is usually wanted right after the first.
116-
<MenuItem
117-
key={candidateKey(candidate)}
118-
closeOnClick={false}
157+
candidates.map((candidate, index) => (
158+
<ComboboxItem
159+
key={keys[index]}
160+
hideIndicator
161+
index={index}
162+
value={keys[index]}
119163
disabled={disabled}
120-
onClick={() => onSelect(candidate)}
121164
className="min-h-0 py-1.5 text-xs sm:min-h-0 sm:text-xs"
165+
contentClassName="flex min-w-0 items-center gap-2"
122166
>
123167
{children(candidate)}
124-
</MenuItem>
168+
</ComboboxItem>
125169
))
126170
)}
127171
{truncated ? (
128172
// Typing filters what arrived; it does not ask the host again, so this says what the
129173
// list is rather than offering a search that would find nothing further.
130174
<p className="px-2 py-1.5 text-xs text-muted-foreground">{truncatedLabel}</p>
131175
) : null}
132-
</div>
133-
</MenuPopup>
134-
</Menu>
176+
</ComboboxList>
177+
</ComboboxPopup>
178+
</Combobox>
135179
);
136180
}

‎apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx‎

Lines changed: 50 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,41 +1478,6 @@ export function PullRequestDetailPanel({
14781478
</MenuPopup>
14791479
</Menu>
14801480
) : null}
1481-
{workflowApprovalsRequired > 0 && can("approve-workflows") ? (
1482-
<Tooltip>
1483-
<TooltipTrigger
1484-
render={
1485-
<span className="inline-flex shrink-0">
1486-
<Button
1487-
size="xs"
1488-
variant="warning-outline"
1489-
disabled={actionPending}
1490-
onClick={() =>
1491-
setConfirmation({ open: true, action: "approve-workflows" })
1492-
}
1493-
aria-label={
1494-
pendingAction === "approve-workflows"
1495-
? "Approving..."
1496-
: "Approve workflows to run"
1497-
}
1498-
>
1499-
<PlayIcon aria-hidden className="size-3.5" />
1500-
<span className="@max-[40rem]/pr-header:hidden">
1501-
{pendingAction === "approve-workflows"
1502-
? "Approving..."
1503-
: "Approve workflows to run"}
1504-
</span>
1505-
</Button>
1506-
</span>
1507-
}
1508-
/>
1509-
<TooltipPopup side="top">
1510-
{pendingAction === "approve-workflows"
1511-
? "Approving..."
1512-
: "Approve workflows to run"}
1513-
</TooltipPopup>
1514-
</Tooltip>
1515-
) : null}
15161481
{/* Said where the Merge button is, because it is the answer to why nobody has
15171482
pressed it: the merge is already asked for, and the host is holding it. */}
15181483
{autoMergeArmed && primaryAction !== "auto-merge-armed" ? (
@@ -2165,20 +2130,58 @@ export function PullRequestDetailPanel({
21652130
))}
21662131
</ToggleGroup>
21672132
{tab === "summary" ? (
2168-
<span
2169-
className="ml-auto inline-flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground"
2170-
aria-label={checksSummary ? `Checks: ${checksSummary}` : "Checks"}
2171-
>
2172-
{checksState !== null ? (
2173-
<PullRequestChecksPopover
2174-
checks={detail.checks}
2175-
checksState={checksState}
2176-
threadRef={threadRef}
2177-
/>
2133+
<span className="ml-auto inline-flex shrink-0 items-center">
2134+
{workflowApprovalsRequired > 0 && can("approve-workflows") ? (
2135+
<Tooltip>
2136+
<TooltipTrigger
2137+
render={
2138+
<span className="inline-flex shrink-0">
2139+
<Button
2140+
size="xs"
2141+
variant="warning-outline"
2142+
disabled={actionPending}
2143+
onClick={() =>
2144+
setConfirmation({ open: true, action: "approve-workflows" })
2145+
}
2146+
aria-label={
2147+
pendingAction === "approve-workflows"
2148+
? "Approving..."
2149+
: "Approve workflows to run"
2150+
}
2151+
>
2152+
<PlayIcon aria-hidden className="size-3.5" />
2153+
<span>
2154+
{pendingAction === "approve-workflows"
2155+
? "Approving..."
2156+
: "Approve workflows to run"}
2157+
</span>
2158+
</Button>
2159+
</span>
2160+
}
2161+
/>
2162+
<TooltipPopup side="top">
2163+
{pendingAction === "approve-workflows"
2164+
? "Approving..."
2165+
: "Approve workflows to run"}
2166+
</TooltipPopup>
2167+
</Tooltip>
21782168
) : (
2179-
<CircleDotIcon aria-hidden className="size-3.5" />
2169+
<span
2170+
className="inline-flex items-center gap-1.5 text-xs text-muted-foreground"
2171+
aria-label={checksSummary ? `Checks: ${checksSummary}` : "Checks"}
2172+
>
2173+
{checksState !== null ? (
2174+
<PullRequestChecksPopover
2175+
checks={detail.checks}
2176+
checksState={checksState}
2177+
threadRef={threadRef}
2178+
/>
2179+
) : (
2180+
<CircleDotIcon aria-hidden className="size-3.5" />
2181+
)}
2182+
{checksSummary}
2183+
</span>
21802184
)}
2181-
{checksSummary}
21822185
</span>
21832186
) : tab === "timeline" ? (
21842187
<div className="ml-auto flex shrink-0 items-center gap-2 text-xs text-muted-foreground">

0 commit comments

Comments
 (0)