question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CSS is being displayed on page shortly before being hidden

See original GitHub issue

Current behavior:

The CSS is being displayed within the page before being hidden. (flash)

Here’s the content that’s being displayed:

<style data-emotion="css 1s3l8we" data-s="">.css-1s3l8we{margin:0 45px 0 45px;position:absolute;cursor:pointer;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;}.css-1s3l8we:focus{outline:none;}.css-1s3l8we .label{cursor:default;}@media (max-width: 991.98px){.css-1s3l8we{width:100%;-webkit-box-pack:left;-ms-flex-pack:left;-webkit-justify-content:left;justify-content:left;margin:0;}.css-1s3l8we .label{margin-left:25px;}.css-1s3l8we .stamps,.css-1s3l8we .links,.css-1s3l8we .contact,.css-1s3l8we .column-divider{display:none;}}</style>

image

It’s been happening for months, it’s not something new.

To reproduce:

Happens only within my private app and I don’t know what’s causing this, can’t reproduce it.

Go to https://tfp-sc1-2l-1c-xp-37wm0wymn-unly.vercel.app/en/solutions displays the flash. Lowering the network speed (Console Network settings) makes the transition a bit slower.

Expected behavior:

It shouldn’t display the CSS on the page

Environment information:

  • react version: 17.0.1
  • @emotion/react version: 11.1.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Andaristcommented, Mar 15, 2021

I haven’t seen such warnings. Where are they supposed to be displayed?

Not all selectors are validated right now - the detection could definitely be improved there. The logic for it is here: https://github.com/emotion-js/emotion/blob/71ca9be3368ddb0a95ef5b2db7a97c67ab440593/packages/cache/src/stylis-plugins.js#L133

0reactions
Vadorequestcommented, Mar 14, 2021

Using

> div {
  display: flex;
  align-items: center;

  @media (min-width: 992px) {
    display: flex !important; // Overrides bootstrap to force using flex with desktop to center vertically elements
  }
}

instead of

> * {
  display: flex;
  align-items: center;

  @media (min-width: 992px) {
    display: flex !important; // Overrides bootstrap to force using flex with desktop to center vertically elements
  }
}

fixed the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

content-visibility | CSS-Tricks
The content-visibility property in CSS indicates to the browser whether or not an element's contents should be rendered at initial load time ...
Read more >
content-visibility - CSS: Cascading Style Sheets | MDN
The content-visibility CSS property controls whether or not an element renders its contents at all, along with forcing a strong set of ...
Read more >
javascript - Hide div on page but div shows before being hidden
Set the div's display to none with CSS, not Javascript. Then change the display property with Javascript when you want it to be...
Read more >
CSS Layout - The display Property - W3Schools
display: none ; is commonly used with JavaScript to hide and show elements without deleting and recreating them. Take a look at our...
Read more >
CSS in Action - Invisible Content Just for Screen Reader Users
display:none or visibility: hidden ... These styles will hide content from all users. The content is removed from the visual flow of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found