Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit a9a75b6

Browse files
committed
fix: add more changes to opacity logic
1 parent ef4c87e commit a9a75b6

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

windows-rdp/devolutions-patch.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ function setupAlwaysOnStyles() {
360360

361361
function hideFormForInitialSubmission() {
362362
const styleId = "coder-patch--styles-initial-submission";
363-
const opacityVariableName = "--coder-opacity-multiplier";
363+
const cssOpacityVariableName = "--coder-opacity-multiplier";
364364

365365
/** @type {HTMLStyleElement | null} */
366366
let styleContainer = document.querySelector("#" + styleId);
@@ -378,12 +378,12 @@ function hideFormForInitialSubmission() {
378378
but the rest of the function should be in charge of making the form
379379
container visible again if something goes wrong during setup.
380380
*/
381-
$${opacityVariableName}: 0;
381+
$${cssOpacityVariableName}: 0;
382382
}
383383
384384
/* web-client-form is the container for the main session form */
385385
web-client-form {
386-
opacity: calc(100% * var($${opacityVariableName})) !important;
386+
opacity: calc(100% * var($${cssOpacityVariableName})) !important;
387387
}
388388
`;
389389

@@ -405,18 +405,26 @@ function hideFormForInitialSubmission() {
405405
// of the rest of the app. Even if the form isn't hidden at the style level,
406406
// it will still be covered up.
407407
const restoreOpacity = () => {
408-
rootNode.style.setProperty(opacityVariableName, "1");
408+
rootNode.style.setProperty(cssOpacityVariableName, "1");
409409
};
410410

411411
// If this file gets more complicated, it might make sense to set up the
412412
// timeout and event listener so that if one triggers, it cancels the other,
413413
// but having restoreOpacity run more than once is a no-op for right now.
414414
// Not a big deal if these don't get cleaned up.
415+
window.setTimeout(restoreOpacity, 5_000);
415416

416417
/** @type {HTMLFormElement | null} */
417418
const form = document.querySelector("web-client-form > form");
418-
form?.addEventListener("submit", restoreOpacity, { once: true });
419-
window.setTimeout(restoreOpacity, 5_000);
419+
form?.addEventListener(
420+
"submit",
421+
() => {
422+
// Not restoring opacity right away just to give the HTML canvas a little
423+
// bit of time to get spun up and cover up the main form
424+
window.setTimeout(restoreOpacity, 1_000);
425+
},
426+
{ once: true },
427+
);
420428
}
421429

422430
function setupFormOverrides() {

0 commit comments

Comments
 (0)