project-pegaprox icon indicating copy to clipboard operation
project-pegaprox copied to clipboard

[Bug] I can switch the screen to the left and make the screen disappear by clicking (and holding) the left mouse button and moving in the Shell screen

Open nvaert1986 opened this issue 3 months ago • 7 comments

Describe the bug

I can switch the screen to the left and make the screen disappear by clicking (and holding) the left mouse button and moving, specifically when I press the Cancel button (might be related to: #726 )

Steps to Reproduce

  1. Log in
  2. Select a Cluster
  3. Select a Node
  4. Press Shell
  5. Press Cancel
  6. Press the left mouse button (and hold it) and swipe left or right on the main window (see the screenshot for details of what happens).

Expected behavior

The screen should not move to the left making a part invisible.

Environment

  • PegaProx Version: 1.0.2
  • Installation Method: Manual
  • OS: Debian 13
  • Browser: Mozilla Firefox and Google Chrome (latest versions)
  • Behind Reverse Proxy? No
  • UI? Corporate

Logs

None

Screenshots

Image

Checklist

  • [X] I have searched existing issues to make sure this is not a duplicate
  • [X] I am using the latest version of PegaProx

nvaert1986 avatar Aug 21 '26 08:08 nvaert1986

Thanks. To make sure I've got it: after the shell modal is closed via Cancel, a click-and-hold drag on the main window shifts the layout left and clips part of it off-screen. That reads like a stray drag/pan interaction not being cleaned up when the terminal tears down — so you're likely right that it's adjacent to the #726 shell path.

It's cosmetic and non-destructive, so I'm keeping it below the cert/migration fixes in priority, but it's a real glitch and I've noted it for a frontend pass. If you can grab a short screen recording, or (in browser devtools) the element that ends up with the transform/translate when it happens, that'd shortcut the fix. Leaving it open.

mkellermann97 avatar Aug 23 '26 17:08 mkellermann97

Thanks. To make sure I've got it: after the shell modal is closed via Cancel, a click-and-hold drag on the main window shifts the layout left and clips part of it off-screen. That reads like a stray drag/pan interaction not being cleaned up when the terminal tears down — so you're likely right that it's adjacent to the https://github.com/PegaProx/project-pegaprox/issues/726 shell path. <- Conformed that's exactly what I meant.

nvaert1986 avatar Aug 26 '26 08:08 nvaert1986

Thanks. I went through all the node-shell paths and couldn't find where a drag would close or hide the shell: the shell modal doesn't close on a backdrop click, the fullscreen shell only closes via its X button, and the shell tab is a fixed-size container with no horizontal scroll or swipe handler. So I can't reproduce it from the code yet.

To pin it down, could you share:

  • which layout you're using (Modern / Corporate / Cloud),
  • the exact steps, and ideally a short screen recording,
  • browser + OS.

With that I can reproduce it directly and fix the right thing rather than guess. Thanks!

mkellermann97 avatar Aug 30 '26 12:08 mkellermann97

Thanks. I went through all the node-shell paths and couldn't find where a drag would close or hide the shell: the shell modal doesn't close on a backdrop click, the fullscreen shell only closes via its X button, and the shell tab is a fixed-size container with no horizontal scroll or swipe handler. So I can't reproduce it from the code yet.

To pin it down, could you share:

* which layout you're using (Modern / Corporate / Cloud),

* the exact steps, and ideally a short screen recording,

* browser + OS.

With that I can reproduce it directly and fix the right thing rather than guess. Thanks!

  • I'm using the Corporate mode
  • I'm using Gentoo Linux 2.18 (it's a rolling release distribution)
  • I've just verified the bug doesn't exist in Google Chrome (can't reproduce it with Google Chrome anymore)
  • I've just verified the bug still exists in Mozilla Firefox.

Everything done below is done with Claude (to speed up the stepping process).

Describe the bug

On a node's Shell tab, cancelling the "SSH Login" dialog and then pressing and holding the left mouse button in the empty area below the terminal and dragging left or right moves the terminal and the entire application layout off-screen. The layout does not come back.

This reproduces in Firefox and does not reproduce in Chrome. A Chrome session was instrumented and measured (details under "Chrome session, negative control" below); no scroll, no transform and no layout shift occurs there. This is the likely reason the issue could not be reproduced by the maintainers.

Steps to Reproduce

  1. Sign in to the PegaProx web UI (Corporate layout, corp-* classes).
  2. In the sidebar tree, expand a cluster and click a node (here: hv01, Legacy cluster).
  3. Open the node's Shell tab. The xterm terminal is instantiated and prints:
    Verbinde zum Server...
    Ermittle Node-IP...
    Node-IP: 10.0.0.1 (manager_get_node_ip)
    Connecting WebSocket (Port 445)...
    WebSocket connected, waiting for server...
    
    and the modal SSH Login - hv01 opens on top of the terminal.
  4. Press Cancel in that dialog. The terminal prints Cancelled, then Verbindung beendet and (Switch tab and back to reconnect).
  5. Press and hold the left mouse button in the empty area below the terminal panel, drag left (or right) and release.

Expected behavior

A press and drag on inert background area below the terminal selects text at most. It must not scroll or translate the application shell, and any shift must be recoverable.

Actual behavior

The terminal and the whole application layout move off-screen horizontally and stay there.

Relevant DOM structure (measured in the running app)

The SSH Login overlay is not portalled to document.body. It is mounted inside the terminal panel itself. Ancestor chain of the Cancel button, innermost first:

# Element Notable computed style
1 button.flex-1.py-2.bg-gray-600... (Cancel) position: static
2 div.flex.gap-2.pt-2
3 div.space-y-3
4 div.bg-proxmox-card.border.border-proxmox-border.rounded-xl.p-6.w-full.max-w-md
5 div.fixed.inset-0.flex.items-center.justify-center.bg-black/90.z-[100].p-4 position: fixed, z-index: 100
6 div.w-full.h-full.relative position: relative
7 div.bg-black.border.border-proxmox-border.overflow-hidden overflow-x/y: hidden (terminal panel)
8 div.p-4
9 div.space-y-0 / div.space-y-3.corp-content-fade
10 div.flex-1.min-w-0.px-3.py-2 main content column (drag target in step 5)
11 div.flex.gap-0 sidebar + content row
12 div.min-h-screen.bg-proxmox-darker.text-white.pb-7 app shell

Two elements are relevant to a horizontal shift:

  • div.bg-black.border.border-proxmox-border.overflow-hidden (row 7), the only ancestor of .xterm with overflow other than visible. overflow: hidden boxes remain programmatically and autoscroll-scrollable; only overflow: clip is not. If Firefox's selection autoscroll drives scrollLeft on this box (or on the app shell), content shifts with no scrollbar available to shift it back, which matches the reported symptom.
  • div.corp-resize-handle, cursor: col-resize, 4 x 847 px at x=224, the sidebar splitter. A document-level mousemove/mouseup drag handler that is left armed would make any later press and drag act as a splitter drag. Note the Cancel button unmounts its own subtree, so a mouseup handler bound to a node inside the overlay can never fire; Firefox and Chrome differ in how events are delivered once the node under the cursor is removed.

Both are hypotheses, stated as such. The measurements below are facts.

Chrome session, negative control (what was tested, and the numbers)

Environment: Chrome, viewport 2560 x 1296 CSS px, devicePixelRatio: 1, PegaProx 1.0.2, node hv01 (PVE 9.2.10, kernel Linux 7.0.14-11-pve), node IP 10.255.13.21.

Baseline immediately after pressing Cancel (step 4), read from the live DOM:

window.scrollX                        0
document.documentElement.scrollWidth  2560
document.documentElement.clientWidth  2560
document.body.scrollWidth             2560
.min-h-screen  transform              none      rect.x  0
.xterm         rect.x 257  width 2274

Drag A, inside the terminal text area. Press at CSS (1315, 444), drag to (411, 444), release. Result: an xterm selection band is drawn (normal text selection). No scroll, no transform.

Drag B, in the empty area below the terminal (the reported gesture). Press at CSS (1315, 773) on div.flex-1.min-w-0.px-3.py-2, five intermediate moves at x = 1134, 953, 773, 592, 411, release. Capture-phase listeners recorded 15 events (pointerdown/mousedown, 5 x pointermove/mousemove, pointerup/mouseup); none had defaultPrevented === true. Result after release:

window.scrollX                        0     (unchanged)
document.documentElement.scrollWidth  2560  (== clientWidth, no horizontal overflow)
.min-h-screen  transform              none  rect.x  0  (unchanged)
window.getSelection()                  empty

Overflow audit of the full .xterm ancestor chain in Chrome. Exactly one ancestor has overflow other than visible:

div.bg-black.border.border-proxmox-border.overflow-hidden
  overflow-x: hidden   overflow-y: hidden   user-select: auto
  clientWidth 2274     scrollWidth 2274     scrollLeft 0

Zero hidden horizontal overflow in Chrome at this viewport, so there is nothing for an autoscroll to scroll, which is consistent with Chrome not reproducing the bug. The same measurement taken in Firefox is the thing to compare against.

Environment

  • PegaProx Version: 1.0.2 (footer of the UI; build to be confirmed)
  • UI: Corporate layout
  • Affected browser: Mozilla Firefox 154.0.1 on Linux (KDE Plasma)
  • Not affected: Chrome (verified with the measurements above, viewport 2560 x 1296, dpr 1)
  • Node: Proxmox VE 9.2.10, kernel Linux 7.0.14-11-pve
  • Behind reverse proxy? No, PegaProx terminates TLS on 443 itself

nvaert1986 avatar Aug 31 '26 07:08 nvaert1986

Coming back to this one — I think the last round looked in the wrong place.

We went hunting for something in the shell modal that a drag could close or hide, and found nothing, which is consistent: reading your steps again, the shell is already gone by the time it happens. You press Cancel first, and then drag on the main window. So the question isn't what the shell does — it's what it leaves behind that makes the page wider than the window, because once that's true, dragging just scrolls it.

That's testable in one line. Do the repro, and before dragging, open the console and run:

[document.body.scrollWidth, document.documentElement.scrollWidth, window.innerWidth]

If the first two are larger than the third, that's the whole bug and I can go find what's sticking out. If all three match, then it's not overflow and I'll think again.

I tried to drive it here on Corporate and couldn't get as far as your step 4 by script, so I'd rather have the number from your setup than keep guessing at mine.

Marcus

mkellermann97 avatar Sep 15 '26 05:09 mkellermann97

Found it, and it is fixed on Testing. Thanks for staying with this one - and sorry it took so long. My earlier guesses were looking in the wrong place twice over.

I stopped asking and took the measurement myself, in Firefox, with the steps from your report. With the shell open:

document.documentElement.scrollWidth = 50000
window.innerWidth                    =  2560

So the page really is nearly twenty times wider than the window, exactly as I suspected in September - but the thing sticking out is not ours. xterm.js 5.3.0 parks its character-width cache on document.body:

<div style="position: absolute; top: -50000px; width: 50000px; white-space: pre; font-kerning: none; ...">

It sits 50000 px above the viewport, so nobody ever sees it, and it stays for as long as a terminal is alive. Vertically that is harmless. Horizontally it makes the document 50000 px wide, and a page that wide can be dragged sideways. That is the whole bug: your drag is not moving the layout, it is scrolling the page into the empty space next to it.

Why only Firefox: Chrome does not pan the page on that gesture. Nothing is actually different about the two - your Chrome measurement was of the terminal container (clientWidth 2274 scrollWidth 2274), which is correct in both browsers. The number that differs is the one on document, and I should have asked for that one in the first place rather than for the container.

The fix takes the measuring div out of the page flow, so the document goes back to window width:

body > div[style*="-50000px"] { position: fixed !important; }

Measured before and after, in your browser at your viewport:

ohne Fix                         docScrollW= 50000  pan= 4800  sticky-Kopf top=0
html, body { overflow-x: hidden} docScrollW= 50000  pan=    0  sticky-Kopf top=-314
Messelement position: fixed      docScrollW=  2560  pan=    0  sticky-Kopf top=0

The middle row is the obvious remedy and the wrong one - it stops the panning but turns the page root into a scroll box and the sticky header stops sticking. There was already a comment in our stylesheet warning about exactly that; now there is a number behind it.

Two things fell out of this that you may care about:

  • The character cell still measures 10.12 px with the fix in place, so xterm's own layout is untouched.
  • The phone-layout rule that tries to do the same job with overflow-x: clip does not actually prevent the pan in Firefox either (measured: still 4800). That is a separate, older piece of work and I have noted it rather than change it blind.

Not related to #726 after all, and not the shell teardown - the shell is already gone by the time you drag, as you said. It was what it left standing.

mkellermann97 avatar Sep 28 '26 18:09 mkellermann97

This turned out to be a hidden width-measuring element that xterm.js puts on the page while a terminal is open: it made the page 50000 px wide, so Firefox could drag the whole layout sideways. That element is now taken out of the page flow, so the page stays at window width and the drag no longer moves anything. The fix ships in 1.3.0.

(We're donation-funded, https://opencollective.com/pegaprox, in case that's an option for you.)

Marcus

mkellermann97 avatar Oct 07 '26 04:10 mkellermann97