File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -289,12 +289,23 @@ async function loadApp() {
289289 // in case the Tinter.tint() in MatrixChat fires before the
290290 // CSS has actually loaded (which in practice happens)...
291291
292- // FIXME: we should probably block loading the app or even
293- // showing a spinner until the theme is loaded, to avoid
294- // flashes of unstyled content.
295- a . onload = ( ) => {
292+ // This if fixes Tinter.setTheme to not fire on Firefox
293+ // in case it is the first time loading Riot.
294+ // `InstallTrigger` is a Object which only exists on Firefox
295+ // (it is used for their Plugins) and can be used as a
296+ // feature check.
297+ // Firefox loads css always before js. This is why we dont use
298+ // onload or it's EventListener as thoose will never trigger.
299+ if ( typeof InstallTrigger !== 'undefined' ) {
296300 Tinter . setTheme ( theme ) ;
297- } ;
301+ } else {
302+ // FIXME: we should probably block loading the app or even
303+ // showing a spinner until the theme is loaded, to avoid
304+ // flashes of unstyled content.
305+ a . onload = ( ) => {
306+ Tinter . setTheme ( theme ) ;
307+ } ;
308+ }
298309 } else {
299310 // Firefox requires this to not be done via `setAttribute`
300311 // or via HTML.
You can’t perform that action at this time.
0 commit comments