Skip to content

fix(modal): re-center the drawer card when the sidebar zone changes while the drawer is open (#604 follow-up) #612

Description

@vibechoom

Deferred scope from PR #604 (which fixed #600). Filing so it doesn't stay parked only in a merged PR body.

What

PR #604 made the drawer card lay out from the screen's trailing edge so it centres against the bar's surface rather than the monitor. Its own body names the leftover:

Out of scope: toggling the sidebar while the drawer is already open doesn't re-center the card (nothing recomputes the margin on a zone change). Practically unreachable — the drawer's fullscreen click-catcher retracts on any click — and fixing it would mean subscribing modal to sidebar state, which is the coupling this fix avoids.

So: open the drawer, then toggle the sidebar without dismissing the drawer, and the card keeps the margin computed for the old zone.

Severity

Low, and arguably zero in practice. The drawer installs a fullscreen click-catcher that retracts on any click, so there is no ordinary pointer path that toggles the sidebar with the drawer still up. It becomes reachable only via a non-pointer trigger — e.g. a niri keybind driving the sidebar action from commands.rs while the drawer is open. That path exists, which is the only reason this is worth a ticket rather than a shrug.

Why it wasn't just fixed

The obvious fix — have modal subscribe to sidebar state and recompute on change — reintroduces exactly the modal → sidebar coupling #604 was written to avoid. That tradeoff deserves a deliberate decision rather than being smuggled in as a follow-up commit.

Recommendation

Leave it parked unless the keybind path turns out to matter. If it does, prefer re-running the existing post-map recompute (wire_recenter_on_map's path) on a zone-change signal over making modal a general subscriber of sidebar state — that keeps the coupling to one edge-triggered recompute instead of a standing subscription.

Refs #604, #600.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions