@@ -360,7 +360,7 @@ function setupAlwaysOnStyles() {
360
360
361
361
function hideFormForInitialSubmission ( ) {
362
362
const styleId = "coder-patch--styles-initial-submission" ;
363
- const opacityVariableName = "--coder-opacity-multiplier" ;
363
+ const cssOpacityVariableName = "--coder-opacity-multiplier" ;
364
364
365
365
/** @type {HTMLStyleElement | null } */
366
366
let styleContainer = document . querySelector ( "#" + styleId ) ;
@@ -378,12 +378,12 @@ function hideFormForInitialSubmission() {
378
378
but the rest of the function should be in charge of making the form
379
379
container visible again if something goes wrong during setup.
380
380
*/
381
- $${ opacityVariableName } : 0;
381
+ $${ cssOpacityVariableName } : 0;
382
382
}
383
383
384
384
/* web-client-form is the container for the main session form */
385
385
web-client-form {
386
- opacity: calc(100% * var($${ opacityVariableName } )) !important;
386
+ opacity: calc(100% * var($${ cssOpacityVariableName } )) !important;
387
387
}
388
388
` ;
389
389
@@ -405,18 +405,26 @@ function hideFormForInitialSubmission() {
405
405
// of the rest of the app. Even if the form isn't hidden at the style level,
406
406
// it will still be covered up.
407
407
const restoreOpacity = ( ) => {
408
- rootNode . style . setProperty ( opacityVariableName , "1" ) ;
408
+ rootNode . style . setProperty ( cssOpacityVariableName , "1" ) ;
409
409
} ;
410
410
411
411
// If this file gets more complicated, it might make sense to set up the
412
412
// timeout and event listener so that if one triggers, it cancels the other,
413
413
// but having restoreOpacity run more than once is a no-op for right now.
414
414
// Not a big deal if these don't get cleaned up.
415
+ window . setTimeout ( restoreOpacity , 5_000 ) ;
415
416
416
417
/** @type {HTMLFormElement | null } */
417
418
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
+ ) ;
420
428
}
421
429
422
430
function setupFormOverrides ( ) {
0 commit comments