Skip to content

Context-window usage indicator flickers when hovered on compact viewports #3334

Closed

Description

@dillonzq

Summary

On compact/mobile viewports, hovering the context-window usage indicator in the follow-up composer makes the popover flicker continuously. The popover opens as the shared responsive bottom drawer, the trigger then leaves the hover region, and the drawer closes and reopens as the pointer re-enters. The indicator should open once and remain stable; tapping or keyboard activation should continue to work.

Versions and environment

  • bb 0.42.1, reproduced from source on main at commit 682f0d2c5dc5bbe920d4a253f66a6c5cedcb955b
  • macOS 26.6.2
  • Node.js v26.8.1
  • Web UI reached through a bb Connect test instance; exact browser version was not collected
  • Provider-independent composer UI behavior
  • Investigation thread: thr_79iew88x8f

Steps to reproduce

  1. Open a bb thread in a compact viewport, such as a phone-sized browser window.
  2. Expand the follow-up composer so the context-window usage indicator is visible in the footer.
  3. Hover the circular context-window indicator.
  4. Observe the responsive popover/drawer as it repeatedly opens and closes.
  5. Click or tap the indicator and compare the result with the hover behavior.

Expected vs actual

Expected: Hovering the indicator opens one stable context-window popover, or compact layouts ignore hover and require an explicit click/tap. The popover should not visibly reopen and close.

Actual: The popover opens as a bottom drawer, loses the trigger's hover state, closes, and immediately reopens. This produces visible flashing and makes the usage details difficult to read.

Evidence

The context-window indicator uses the shared hover-popover hook:

const {
open: hoverOpen,
triggerHoverProps,
contentHoverProps,
handleOpenChange,
} = useHoverPopover({
closeDelayMs: CONTEXT_WINDOW_POPOVER_CLOSE_DELAY_MS,
hoverableContent: false,
});

The hook disables pointer hover only for coarse pointers, so a fine pointer in a compact viewport still attaches pointer enter/leave handlers and schedules open/close transitions:

openDelayMs = DEFAULT_OPEN_DELAY_MS,
closeDelayMs = DEFAULT_CLOSE_DELAY_MS,
hoverableContent = true,
}: UseHoverPopoverOptions = {}): UseHoverPopoverResult {
const isPointerCoarse = usePointerCoarse();
const [open, setOpen] = useState(false);
const [isFocusOverTrigger, setIsFocusOverTrigger] = useState(false);
const [isFocusOverContent, setIsFocusOverContent] = useState(false);
const [isPointerOverTrigger, setIsPointerOverTrigger] = useState(false);
const [isPointerOverContent, setIsPointerOverContent] = useState(false);
const toggleTimeoutRef = useRef<number | null>(null);
const clearToggleTimeout = useCallback(() => {
if (toggleTimeoutRef.current === null) {
return;
}
window.clearTimeout(toggleTimeoutRef.current);
toggleTimeoutRef.current = null;
}, []);
useEffect(() => {
if (isPointerCoarse) return;
clearToggleTimeout();
if (isFocusOverTrigger || isFocusOverContent) {
if (!open) setOpen(true);
return;
}
if (isPointerOverTrigger || isPointerOverContent) {
if (open) return;
if (openDelayMs <= 0) {
setOpen(true);
return;
}
toggleTimeoutRef.current = window.setTimeout(() => {
setOpen(true);
toggleTimeoutRef.current = null;
}, openDelayMs);
return clearToggleTimeout;
}
if (!open) return;
toggleTimeoutRef.current = window.setTimeout(() => {
setOpen(false);
toggleTimeoutRef.current = null;
}, closeDelayMs);
return clearToggleTimeout;
}, [
clearToggleTimeout,
closeDelayMs,
isFocusOverContent,
isFocusOverTrigger,
isPointerCoarse,
isPointerOverContent,
isPointerOverTrigger,
open,
openDelayMs,
]);
useEffect(() => clearToggleTimeout, [clearToggleTimeout]);

The shared popover intentionally renders its content as a responsive drawer on compact viewports:

function Popover({
children,
open: controlledOpen,
onOpenChange: controlledOnChange,
defaultOpen,
...props
}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
const ctx = useResponsiveRoot(
controlledOpen,
controlledOnChange,
defaultOpen,
);
if (ctx.isCompactViewport) {
return (
<ResponsivePopoverContext.Provider value={ctx}>
{children}
</ResponsivePopoverContext.Provider>
);
}
return (
<PopoverPrimitive.Root
open={ctx.open}
onOpenChange={ctx.onOpenChange}
{...props}
>
<ResponsivePopoverContext.Provider value={ctx}>
{children}
</ResponsivePopoverContext.Provider>
</PopoverPrimitive.Root>
);
}

if (isCompactViewport) {
const domProps = stripRadixContentProps(props);
return (
<ResponsiveDrawerShell
open={open}
onOpenChange={onOpenChange}
srLabel={mobileTitle ?? "Options"}
contentClassName={mobileClassName}
onContentAnimationEnd={onMobileContentAnimationEnd}
>
<div
ref={ref}
className={cn(
"overflow-y-auto px-4 pt-2 pb-[max(1rem,env(safe-area-inset-bottom))]",
className,
)}
{...domProps}
>
{children}
</div>
</ResponsiveDrawerShell>

The focused regression test added during the investigation reproduces the relevant pre-fix state transition and verifies that compact hover is disabled while explicit opening remains available.

What you ruled out

Suggested priority and effort

Medium: the context details remain available through a click/tap, but the compact hover path visibly flashes and prevents reliable inspection. The smallest fix is to suppress pointer-hover open/close for compact viewports in the shared hover-popover hook while retaining focus and explicit activation, plus a regression test.

AGENT GENERATED

Activity

  1. added theissue type on Sep 9, 2026
  2. added
    ui
    mobile
    partial-repro
    on Sep 9, 2026
  3. bb-slop-cop commented on Sep 9, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Applied Bug · Medium priority · Low effort and ui, mobile.

    Reproduction report: PARTIALLY REPRODUCED, high root-cause confidence; label partial-repro.

    Fine-pointer hover remains enabled when compact popovers use a pointer-covering drawer. Two clean trusted checkouts produced open → closed → open after one hover, failing the stability assertion. Continuous flicker in the full app remains unverified; the report includes the component-fixture limits and test evidence.

    No duplicate PR: #3335 is already open and linked.

    AGENT GENERATED

  4. added a commit that references this issue on Sep 11, 2026
    f9a0ab0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    mobilepartial-reproui

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions