Skip to content

fix(NavigationView): prevent spurious overlay flash when auto mode resizes from minimal → compact#1316

Merged
bdlukaa merged 3 commits intomasterfrom
copilot/fix-auto-display-mode-transition
Mar 21, 2026
Merged

fix(NavigationView): prevent spurious overlay flash when auto mode resizes from minimal → compact#1316
bdlukaa merged 3 commits intomasterfrom
copilot/fix-auto-display-mode-transition

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 21, 2026

In PaneDisplayMode.auto, resizing from minimal (≤640 px) to compact (641–1007 px) briefly shows a full-width pane overlay before the compact pane settles at 50 px.

Root cause

_OpenNavigationPane and _CompactNavigationPane both key their internal AnimatedContainer with the shared GlobalKey _panelKey. This is intentional for smooth compact ↔ expanded width animations. However, the minimal-mode _OpenNavigationPane stays in the widget tree even when the pane is closed (just positioned off-screen), holding AnimatedContainer state at width=320. On transition to compact, Flutter's GlobalKey mechanism moves that element into _CompactNavigationPane, triggering a spurious 320→50 px animation that looks like an overlay flash.

Changes

  • pane.dart – Add usePanelKey flag to _OpenNavigationPane (default true). When false, the AnimatedContainer uses key: null, cutting the GlobalKey link and letting _CompactNavigationPane start fresh at the correct width.
  • view.dart – Pass usePanelKey: false to _OpenNavigationPane inside _buildMinimalView; the minimal overlay never needs to share animation state with the compact pane.
  • view.dart – In _resolveDisplayMode, reset _minimalPaneOpen = false whenever the mode transitions away from minimal, so open-pane state doesn't leak into compact mode.
  • test/navigation_view_test.dart – Add two regression tests: one verifying no lingering animation after minimal→compact resize, one verifying isMinimalPaneOpen is reset on transition.
Original prompt

This section details on the original issue you should resolve

<issue_title>[Navigation View] Auto display mode makes a wrong transition when resizing screen</issue_title>
<issue_description>Describe the bug
In a navigation view, set it to auto pane mode.

To Reproduce
Steps to reproduce the behavior:

  1. Resize the screen from minimal pane (small) until it reaches the compact mode (medium)
  2. See the overlay show up from a brief second.

Expected behavior
No transition. Just display the side bar.

Screenshots
n/a
</issue_description>

<agent_instructions>At the end, update the tests and the changelog.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…l→compact resize

Root cause: _OpenNavigationPane's AnimatedContainer shared _panelKey with
_CompactNavigationPane. When transitioning from minimal to compact mode,
Flutter's GlobalKey mechanism reused the AnimatedContainer state (width=320)
causing a spurious 320→50 width animation visible as a brief overlay.

Fix:
- Add usePanelKey parameter to _OpenNavigationPane (default true)
- Pass usePanelKey: false in _buildMinimalView to prevent state reuse
- Reset _minimalPaneOpen in _resolveDisplayMode when leaving minimal mode

Also: add tests and update CHANGELOG

Co-authored-by: bdlukaa <45696119+bdlukaa@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bdlukaa/fluent_ui/sessions/a98cf501-1708-4d0d-aa16-0b6a2cc5ec59
Copilot AI changed the title [WIP] Fix wrong transition in auto display mode when resizing screen fix(NavigationView): prevent spurious overlay flash when auto mode resizes from minimal → compact Mar 21, 2026
Copilot AI requested a review from bdlukaa March 21, 2026 03:10
@bdlukaa bdlukaa marked this pull request as ready for review March 21, 2026 05:08
@bdlukaa bdlukaa merged commit 17fa784 into master Mar 21, 2026
1 of 3 checks passed
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.

[Navigation View] Auto display mode makes a wrong transition when resizing screen

2 participants