fix(native-chat): switch subagents from the switcher by pointer, and open no preview on handed-back focus

The switcher's modal-less menu closed on pointerdown before the item could
take the click; it is modal now. Focus handed back to a roster entry after a
pointer Back no longer pops its hover preview; keyboard focus and hover still do.
This commit is contained in:
Kelvin Amoaba
2026-11-13 19:39:00 +00:00
parent a93d29b086
commit 5cb2811b45
2 changed files with 13 additions and 2 deletions
@@ -152,6 +152,17 @@ export function NativeChatSubagentEntries({
)
}
/** A hidden row opens no preview; nor does focus handed back after a click, only keyboard focus or a hover. */
function previewAllowed(trigger: HTMLElement | null): boolean {
return (
trigger === null ||
(!trigger.closest('[inert]') &&
(!trigger.matches(':focus') ||
trigger.matches(':focus-visible') ||
trigger.matches(':hover')))
)
}
/** Hover preview: role, model, timing and the longer text the row truncates. */
function SubagentEntryPreview({
agent,
@@ -182,7 +193,7 @@ function SubagentEntryPreview({
return (
<HoverCard
open={open}
onOpenChange={(next) => setOpen(next && !triggerRef.current?.closest('[inert]'))}
onOpenChange={(next) => setOpen(next && previewAllowed(triggerRef.current))}
openDelay={300}
closeDelay={100}
>
@@ -88,7 +88,7 @@ export function NativeChatSubagentViewBar({
<span aria-hidden className="shrink-0 text-xs text-chat-foreground-faint">
/
</span>
<DropdownMenu modal={false}>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
type="button"