Skip to content

Fix popout widget restore state and enforce minimum popout size - #1599

Open
arome wants to merge 4 commits into
masterfrom
fix-popout-widget-restore-and-min-size
Open

arome wants to merge 4 commits into
masterfrom
fix-popout-widget-restore-and-min-size

Conversation

@arome

@arome arome commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes a popped-out (child window) widget docking back into its panel instead of remaining popped out after it is hidden (WidgetState.Hidden) and then shown again.

Details

  • hideTab() now records the popout home location when hiding a popped-out widget's tab, so re-showing it via WIDGET_TAB_OPEN restores it back into its popout window instead of docking to a default panel section.
  • Introduced a TabRestoreState union (WidgetRestoreState | PopoutWidgetRestoreState) used only by SavedTabState/TabHomeState, keeping the narrower WidgetRestoreState type intact for PopoutWidgetState.home.
  • addRemovedTab() restores a tab into a popout widget via addPopoutWidget() when its saved home is a popout restore state.
  • Enforced a 200x200 minimum popout window size (matching Widget.tsx's floating-widget minimum) in the WIDGET_TAB_POPOUT reducer and in FrontstageDef.openPopoutWidgetContainer(), preventing popout windows from shrinking to an invisibly small size across repeated pop-out cycles.
  • Added a Storybook story (Widget/PopoutRestore) demonstrating the fix: pop a widget out, hide it, then show it again and confirm it stays popped out instead of docking back into the panel.

Test plan

  • Added/updated unit tests in NineZoneStateReducer.test.ts and FrontstageDef.test.tsx covering hide/show restore of popout widgets and the minimum popout size enforcement.
  • Manually exercised the new Widget/PopoutRestore Storybook story.

arome and others added 2 commits August 20, 2026 15:05
- hideTab() now records the popout home location when hiding a popped-out
  widget's tab, so re-showing it via WIDGET_TAB_OPEN restores it back into
  its popout window instead of docking to a default panel section.
- Introduced a TabRestoreState union (WidgetRestoreState |
  PopoutWidgetRestoreState) used only by SavedTabState/TabHomeState, keeping
  the narrower WidgetRestoreState type intact for PopoutWidgetState.home.
- addRemovedTab() restores a tab into a popout widget via addPopoutWidget()
  when its saved home is a popout restore state.
- Enforce a 200x200 minimum popout window size (matching Widget.tsx's
  floating-widget minimum) in the WIDGET_TAB_POPOUT reducer and in
  FrontstageDef.openPopoutWidgetContainer(), preventing popout windows from
  shrinking to an invisibly small size across repeated pop-out cycles.
- Added a Storybook story (Widget/PopoutRestore) demonstrating the fix:
  pop a widget out, hide it, then show it again and confirm it stays
  popped out instead of docking back into the panel.

AB#2024472

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@arome
arome requested a review from a team as a code owner August 20, 2026 19:21
@arome
arome enabled auto-merge (squash) August 20, 2026 21:47
@arome
arome requested a lite review from Copilot August 20, 2026 21:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes popout widget restoration so a widget that was popped out, then hidden (WidgetState.Hidden), reopens back into its popout window when shown again, and also enforces a minimum popout window size to prevent progressive shrinking across cycles.

Changes:

  • Persist popout “home” information when hiding a tab from a popout widget, and restore hidden tabs back into popout widgets on re-open.
  • Introduce TabRestoreState (widening tab restore semantics to include popouts) and add popout-aware restore logic in addRemovedTab().
  • Enforce a 200x200 minimum popout window size in both the state reducer and FrontstageDef, with updated tests and a Storybook repro story.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ui/appui-react/src/appui-react/layout/state/NineZoneStateReducer.ts Record popout home on hide; clamp popout bounds to a minimum size during popout creation.
ui/appui-react/src/appui-react/layout/state/WidgetRestoreState.ts Add popout-aware restore state/type-guards for tab restoration.
ui/appui-react/src/appui-react/layout/state/SavedTabState.ts Widen TabHomeState to allow popout restore state.
ui/appui-react/src/appui-react/layout/state/internal/TabStateHelpers.ts Restore removed/hidden tabs into popout widgets when saved home indicates popout.
ui/appui-react/src/appui-react/frontstage/FrontstageDef.tsx Clamp popout window open/resize dimensions to a minimum size.
ui/appui-react/src/test/layout/state/NineZoneStateReducer.test.ts Add/update reducer tests for minimum size clamp and popout hide/show restore.
ui/appui-react/src/test/frontstage/FrontstageDef.test.tsx Add test verifying minimum size is enforced in popout window features.
docs/storybook/src/widget/PopoutRestore.tsx Add Storybook scenario demonstrating popout hide/show restore behavior.
docs/storybook/src/widget/PopoutRestore.stories.tsx Register the new Storybook story and document repro steps.
.changeset/popout-widget-hide-restore.md Add patch changeset describing the fix and minimum size enforcement.
Suppressed comments (1)

ui/appui-react/src/appui-react/layout/state/WidgetRestoreState.ts:65

  • Same as above: the parameter type can be simplified to TabRestoreState for clarity (it still accepts WidgetRestoreState values).
export function isPanelWidgetRestoreState(
  state: WidgetRestoreState | TabRestoreState
): state is PanelWidgetRestoreState {
  return "side" in state;
}

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread ui/appui-react/src/appui-react/layout/state/NineZoneStateReducer.ts Outdated
Comment thread ui/appui-react/src/appui-react/layout/state/WidgetRestoreState.ts
@GerardasB

Copy link
Copy Markdown
Collaborator

@arome could you provide additional details - what is this fixing exactly: repro steps, expected and current behavior, target environment. My main concern is that (especially in browser environment) window popouts require an explicit user action.

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.

3 participants