Skip to content

Add Aero Peek preview with snap-back to dock peek - #392

Open
KarunyaChavan wants to merge 4 commits into
WordPress:trunkfrom
KarunyaChavan:feat/aero-peek
Open

Add Aero Peek preview with snap-back to dock peek#392
KarunyaChavan wants to merge 4 commits into
WordPress:trunkfrom
KarunyaChavan:feat/aero-peek

Conversation

@KarunyaChavan

@KarunyaChavan KarunyaChavan commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

This PR introduces Aero Peek–style preview for dock peek cards. Hovering a card temporarily shows the window's content; moving away snaps the window back to its prior state (minimized windows re-minimize, focus returns to the previously-focused window). Clicking commits the preview permanently.

Closes #359

What changed?

  • src/dock-peek/index.ts
    • Added preview-mode lifecycle: pointerenter captures the window's prior state and restores/focuses it; pointerleave reverts (minimize back or refocus previous).
    • Click commits the preview before the permanent focus action. Preview state is scoped to each popover and cleared on dismiss.
  • src/dock-peek/index.ts
    • Changed popover anchor from tile centre to tile top for left/right docks, so minimized cards expand downward instead of pushing the popover into the browser chrome.
  • assets/css/dock-peek.css
    • Removed translateY(-50%) from left/right dock transforms (popover now top-aligned, grows downward).
    • Instance card hover now shows an accent-coloured border + glow for every previewed window, not just minimized ones.
  • tests/vitest/dock-peek.test.ts
    • New tests covering preview snap-back (minimized and non-minimized), click-commit behaviour, and already-focused-card skipping. Window stubs now simulate realistic state transitions.

- Hovering a peek card temporarily restores/focuses the window and tracks the prior state (minimized / previously-focused window).
- Moving away snaps the window back — minimized windows re-minimize, and focus returns to the previously-focused window.
- Clicking commits the preview permanently by clearing the tracking before the dismiss + focus transition.
- Accent-coloured border + glow on [data-preview] cards distinguishes preview from plain hover; reduced-motion fallback to a 2px outline.
- Verify minimized → hover restore → leave snap-back chain
- Verify non-minimised preview returns focus to previous window
- Verify clicking a previewed card commits without snap-back
- Verify already-focused cards skip preview entirely
- Update window stub to mutate state on restore/minimize so
  conditional guards behave realistically
- Align left/right dock popovers to the tile's top edge instead of vertical centre, so minimised cards expand downward on hover
- Remove translateY(-50%) from left/right CSS transforms; the old centering pushed the top edge into the browser chrome on growth.
- Bottom dock anchor is unchanged (stays above the tile, grows upward).
- Reduce the a11y rule which was being overridden by box-shadows.
@KarunyaChavan
KarunyaChavan marked this pull request as ready for review July 24, 2026 06:13
@KarunyaChavan

Copy link
Copy Markdown
Contributor Author

An Open Question:

Since introducing a new default peek behavior might not feel seamless for everyone, Should we consider adding an option that lets users choose between the current behavior and an Aero Peek (Windows-style) experience ?

@AllTerrainDeveloper

Copy link
Copy Markdown
Collaborator

I'm fine adding more settings under the OS Settings :)

@AllTerrainDeveloper

Copy link
Copy Markdown
Collaborator

@KarunyaChavan Is this PR ready to test/review?

@KarunyaChavan

KarunyaChavan commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@AllTerrainDeveloper, yes, it's ready for review. You can take a look at the Aero Peek behavior.

Regarding the toggle question, I decided to ship with preview as the default behavior and skip adding a toggle for now.

The previous hover interaction was destructive because it permanently changed the layout. The new preview is much safer, since it only shows a temporary preview and clicking still behaves exactly the same.

I'd especially appreciate your feedback on the peek interaction itself. Does it feel smooth and natural, or does it come across as too abrupt?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Aero Peek style preview for dock peek cards

2 participants