Skip to content

fix(macos): preserve shortcut detail lifetime until pointer entry - #310

Open
ludevdot wants to merge 4 commits into
mainfrom
feat/309-shortcut-detail-presence
Open

ludevdot wants to merge 4 commits into
mainfrom
feat/309-shortcut-detail-presence

Conversation

@ludevdot

Copy link
Copy Markdown
Collaborator

Related issue

Refs #309

ODD: not applicable; focused bug fix under the approved issue scope.

Scope

Preserve the existing eight-second lifetime of a shortcut-opened detail while the pointer has never entered either the widget or the detail. The first DOM or native entry ends that initial exception: remaining inside holds the detail open, and leaving both surfaces restores the normal close delay. Native cursor sampling still recovers missed DOM leave events.

Preserve ordinary hover, click pinning, the already-pinned shortcut guard, focus handling, highest-usage provider selection and repeated-shortcut behavior. No explicit focus requests were added.

Exclusions: #278, a shortcut pin toggle, global Escape/outside-click handling, and a presence-model redesign.

File Change
src/Widget.tsx Start shortcut presence grace and forward accepted surface entries to the native presence tracker.
src/lib/detail-presence.ts Ignore initial outside samples only for shortcut openings; resume ordinary presence handling after first entry.
src/lib/auto-hide.test.ts Add seven integration regressions for lifetime, both surfaces, missed DOM leave recovery, repeat and pinned-panel preservation.
docs/i18n-inventory.md Regenerate the source-tree hash after the source commit; no listed texts changed.

Coordination

ODD-specific checklist: N/A.

Contributor: @ludevdot

Acceptance and validation

Criteria satisfied

  • Initial outside native samples no longer replace the eight-second shortcut timeout with the normal close timer.
  • DOM or sampled entry into either surface ends grace; native samples can still close after a missed DOM leave event.
  • Existing hover, pinning, focus-loss and repeated-shortcut behavior are preserved by focused tests and independent verification.

Automated checks actually run

  • Test-first: three new regression cases failed before the fix, then all seven new cases passed.
  • npm test: passed, 1,248 Vitest tests and 329 Node tests.
  • npm run typecheck: passed.
  • npx biome ci: passed, 231 files; 224 warnings and 31 informational diagnostics, no fixes applied.
  • cargo fmt --manifest-path src-tauri/Cargo.toml --check: passed; the installed pre-push hook additionally runs the repository's --all -- --check command.
  • node scripts/i18n-inventory.mjs --check: passed after the generated hash refresh.
  • npm run app:build:mac -- --debug --no-bundle: passed; produced a native debug executable. An unused-variable warning in unchanged src/providers/nan.rs remains.
  • git diff --check: passed.
  • Independent verification found no blockers; twelve additional isolated deterministic probes passed, including reset isolation, focus tracking, pinning and repeated shortcuts.

Controlled native macOS validation

Environment: macOS 26.7.1 (25G241), arm64, MacBook Air M4 with its single integrated display; widget at the right edge, vertically centered; shortcut Option+Control+I.

Before: installed Quorb v0.9.1 (exact installed build identifier unavailable), detail initially closed/unpinned and pointer stationary outside both surfaces. One shortcut opened the detail and it disappeared after approximately 0.5 seconds in 3/3 attempts. The previously active application retained focus.

After: local native debug build from the implementation commit, without installing a bundle:

  • One shortcut with pointer outside: approximately eight seconds in 3/3 attempts; the previously active application retained focus.
  • Entry into either widget or detail: remained open for approximately ten seconds inside, then closed after leaving both surfaces (approximately one second by manual observation).
  • Ordinary hover and click pinning behaved correctly; a pinned detail closed when focus moved to another application.
  • A second shortcut kept the same selected provider. Renewal of the eight-second timer from the second invocation is covered deterministically, not separately timed in the manual trial.

All native durations above are manual approximations, not frame-count measurements. The precise 280 ms close boundary and missed-DOM-event fallback are covered by deterministic tests; ordinary native pointer movement does not prove that a DOM event was missed.

Checks not run and remaining limitations

  • Rust unit tests were not run locally because Rust code was unchanged; native compilation and Rust formatting passed.
  • No local Windows/Linux GUI, installer, signing, notarization or distribution validation was performed.
  • GitHub CI results are pending when this PR is opened. Native approval above does not imply integration or release readiness.
  • No known blocking findings. Additional committed edge-case coverage was suggested during read-only review as a non-blocking improvement.

An open PR does not mean integration. Release, secrets and signing operations require separate authorization.

@ludevdot ludevdot added the type:bug Bug fix label Nov 22, 2026
@ludevdot ludevdot self-assigned this Nov 22, 2026

@egdev6 egdev6 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ludevdot thanks, this is a clean, well-scoped fix, and the native macOS reproduction (before ~0.5 s 3/3, after ~8 s 3/3, focus kept by the active app) is exactly what we asked for in #309.

What looks good:

  • beginShortcut() + awaitingEntry in detail-presence.ts is the right mechanism: outside samples are ignored only until the first entry, then the ordinary rules apply.
  • The sampling effect only calls reset() when there is no providerId, so it does not undo the shortcut state.
  • beginShortcut() runs after the panel.anchored guard, so a pinned detail stays untouched, and no focus is requested.
  • Test-first evidence and the 7 new integration cases cover lifetime, both surfaces, native exit and repeated shortcut.

One change needed before merge:

In applyHover (src/Widget.tsx), if (event.kind === 'enter') presenceRef.cursor(event.surface, true); runs for every hover on every OS, not only during the shortcut grace. On Windows and Linux the native tracker was unused (the sampling effect returns early outside macOS). It now receives DOM entries but never DOM leaves, so inside stays true from then on and the first entry calls cancelClose. I don't see a visible bug, but it changes ordinary hover state on platforms this PR did not validate, and the PR states that ordinary hover is preserved. #278 will build on this presence model, so it is worth not leaving stale state there.

Please scope the forwarding to the grace window, for example only while awaitingEntry is active (or only on macOS), and add a test showing that ordinary hover outside the shortcut grace leaves the presence tracker unchanged.

With that, this is ready to merge once macOS CI is green.

@ludevdot

ludevdot commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator Author

@egdev6 Thanks for catching the ordinary-hover tracker state. Addressed in eb4704d, with the generated inventory refreshed separately in 2628928.

applyHover now forwards accepted entries through entryDuringShortcutGrace(), which is a no-op outside awaitingEntry. Ordinary hover leaves the native tracker unchanged, while the first DOM or backend-relayed entry during grace still enables native recovery of a missed leave. Added regressions for both surfaces and exact tracker hook counts before, during and after grace; the ordinary-hover isolation tests failed against the previous implementation and pass with the correction.

Validation: 1,258 Vitest tests and 329 Node tests passed, along with typecheck, npx biome ci, Rust formatting and inventory checks. Independent verification and a separate read-only review found no blockers. Rebuilt the macOS debug executable and manually rechecked ordinary hover, the eight-second shortcut without stealing focus, and first entry through either surface followed by normal closure; all behaved with the expected approximate timings. New-head CI is not yet confirmed. Ready for your re-review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants