Skip to content

Fix variable-editor dialog closing when resizing the editor - #5487

Merged
norman-abramovitz merged 2 commits into
cloudfoundry:developfrom
nabramovitz:fix/variable-edit-dialog-resize
Jun 23, 2026
Merged

Fix variable-editor dialog closing when resizing the editor#5487
norman-abramovitz merged 2 commits into
cloudfoundry:developfrom
nabramovitz:fix/variable-edit-dialog-resize

Conversation

@nabramovitz

Copy link
Copy Markdown
Contributor

Closes #5486

Problem

The app variable editor (Applications → Variables → Add/Edit) put a CSS resize grip on a small box hugging the Monaco editor. Dragging it to enlarge released the pointer on the backdrop, and the browser's synthesized click resolved to the overlay — which the dialog read as a backdrop click and closed. The editor "resized, then vanished."

Changes

Backdrop dismissal hardened (tailwind-dialog.service.ts) — closing now requires the press to have started on the backdrop, not just the release. A drag that begins inside a dialog (resize grip, text selection) and ends on the backdrop no longer dismisses it. This was latent for every dialog.

Dialog is now movable + corner-resizable instead of the inner editor box. Opt-in draggable/resizable config flags:

  • pin the panel to a fixed viewport position so the native resize grip tracks the cursor 1:1 (a flex-centered panel re-centers and drifts);
  • let it be dragged by its header (data-dialog-drag-handle);
  • make the Monaco editor flex-fill the panel so it grows/shrinks with it (automaticLayout re-fits);
  • clamp both drag and resize to the viewport, so the panel and its action buttons can never be pushed off-screen.

Verification

  • Unit: dialog service spec covers backdrop-drag-doesn't-close, genuine backdrop click still closes, resizable/draggable setup, viewport clamp on drag and resize. All green.
  • Production build (ng build stratos --configuration production) clean.
  • Live against a real CF app: editor grows with the panel; header drag moves it; drag-release on backdrop keeps it open; genuine backdrop click dismisses; drag and resize both clamp on-screen.

Known minor edge

The viewport clamp is computed at open and after each move, not on browser-window resize while the dialog is open. Shrinking the OS window mid-edit could overflow until the panel is nudged — rare for a transient editor; can add a resize re-clamp if wanted.

The app variable editor put a CSS resize grip on a small box hugging
the Monaco editor. Dragging it to enlarge released the pointer on the
backdrop, and the browser's synthesized click resolved to the overlay —
which the dialog read as a backdrop click and closed. Resizes, then
vanishes (cloudfoundry#5486).

Two parts:

- Backdrop dismissal now requires the press to have started on the
  backdrop too, not just the release. A drag that begins inside the
  dialog (resize grip, text selection) and ends on the backdrop no
  longer closes it. This was latent for every dialog.

- The dialog itself is now movable and corner-resizable instead of the
  inner editor box. Opt-in `draggable`/`resizable` flags pin the panel
  to a fixed viewport position so the native resize grip tracks the
  cursor 1:1, let it be dragged by its header, and make the Monaco
  editor flex-fill the panel so it grows with it. Both drag and resize
  are clamped to the viewport so the panel — and its action buttons —
  can never be pushed off-screen.

@norman-abramovitz norman-abramovitz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@norman-abramovitz
norman-abramovitz merged commit 6de6011 into cloudfoundry:develop Jun 23, 2026
12 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.

edit variables dialog closes or crashes when you try to resize the editing window

2 participants