HTML type="module" Problem with flickering UI

<script type="module" src="../../src/lib.js"></script>
type="module" works kind of like defer and dom mutations/changes to text/ui on load lead to flickering. Is there a way to use type="module" but still execute changed to the UI save on load so the user does not see the flicker?

I don’t think what you are seeing is directly related to it being a module.

JS should always wait for the DOM before trying to interact with it. It shouldn’t matter how you do it (module, defer, or loading it after the page content).

Please post a code example.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.