{
  "id": 18854990,
  "title": "Building StareBrain, Part 18: Auto-Collapse — The Overlay That Knows When to Hide",
  "url": "https://urgent.news/2026/11/08/building-starebrain-part-18-auto-collapse-the-overlay-that-knows-when",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-08T04:06:57.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/starebrain/building-starebrain-part-18-auto-collapse-the-overlay-that-knows-when-to-hide-3hd6"
  },
  "original_language": "en",
  "account": null,
  "summary": "In this section of the StareBrain building process, the focus is on implementing an auto-collapse feature for the overlay. The overlay has three states: Idle, Running, and AwaitingConfirmation. The challenge lies in determining when to transition between these states based on user activity rather than just task activity. If a step completes while the user is typing in another app, expanding the overlay mid-keystroke would be incorrect. To address this, an auto-collapse mechanism is introduced, which shrinks the overlay to a dot when the user is actively interacting with another app and expands it only when necessary attention is required. The implementation relies on an AccessibilityService that tracks user interactions using events such as focus changes, window changes, and text input. A UserInteractionTracker class keeps track of the last interaction timestamp and whether the user is considered active. If there is no interaction for 3 seconds, the user is considered inactive. The CollapseController class then uses this information to decide whether to collapse the overlay based on task state and user activity.",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}