Welcome to Babylon! The “viewport” just disappears because, if you change the scene’s handedness, the plane it’s rendered on is placed somewhere the camera can’t see it. Here’s a slight modification:
I only changed lines 3, 58, and 59. Line 3 just sets the handedness. Lines 58 and 59 modify the placement of plane (I just put it in the middle of the screen for convenience) to be sensitive to handedness. Babylon changes handedness by effectively reversing Z; so while (0, 0, 20) is in front of the camera in a left-handed scene, it’s behind the camera in a right-handed scene. You also have to change the orientation of the plane as well (handled in line 59) to make sure that the plane is facing the camera in both handedness scenarios.
As a bit of a sidenote, I think this is a little more complicated than it might otherwise be because the “viewport” is actually a 3D element in the scene, even though it’s trying to behave like a 2D element in the screen. For a real use case, it might be better to render something like this using the GUI, which should have fewer unexpected behaviors.