Prevent FOUC depending on availability of javascript

Created on 14 August 2017, almost 8 years ago
Updated 8 May 2025, 9 days ago

Problem/Motivation

If you are using different styles which depend on the availability of javascript, then several modules and themes make use of the css class js on the <html> tag (for instance Better Exposed Filters ). And I do this too. But I think, the js which add the class is called too late. It's situated in drupal.init.js which is injected at the bottom of the page. And if you have a site with huge amount of content or some heavy images or clean caches, then it can lead to the flickering of components which depends on the js class.

Proposed resolution

I have this FOUC too and can solve it by moving the snippet on the head of the page.

I would like to know your opinions.

Thank you & ciao
Ralf

Feature request
Status

Needs work

Version

11.0 🔥

Component

javascript

Created by

🇩🇪Germany rwam

Live updates comments and jobs are added and updated live.
  • CSS

    It involves the content or handling of Cascading Style Sheets.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024