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 minification changes z-index

See original GitHub issue

Have you read the Contributing Guidelines on issues?

Description

Hey Docusaurus Team,

thanks for your amazing work 😃

We realized recently that docusaurus cleans up z-indices in our custom css that we are loading via customCss: require.resolve('./src/css/custom.css'). My question is: How can I disable the z-index modification? This might be a good feature but can lead to bugs when you are using other third party that bring their own css. We are using '@docusaurus/preset-classic'.

Self-service

  • I’d be willing to address this documentation request myself.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Josh-Cenacommented, Jun 2, 2022

Ah, I see. I think we should find a way to configure it, then.

1reaction
moklickcommented, Jun 2, 2022

It works as intended but I think that it’s not a good default for a platform like docusaurus. As the zindex plugin docs point out it “is unsafe as it could potentially clash with other stylesheets, or JavaScript injected styles”. In our case we are using a third party library on the front page that brings its own CSS and we can’t set our z-indices properly because they get changed by the minification process.

Let’s say you want .element-a and .element-b on top of an element that comes from another library with a real z-index: 1000, you can’t achieve it, because:

.element-a {
  z-index: 1000;
}

.element-b {
 z-index: 1001;
}

will be changed to:

.element-a {
  z-index: 1;
}

.element-b {
 z-index: 2;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

minify css causes problem (or highlights bug) with calc() in ...
The CSS minification algorithm of SG Optimizer results in the alteration of a some of css statements in our code. Specifically. z-index: calc(var(…...
Read more >
The Gulp cssnano z-index Bug and How to Fix It
This is a post about how to overcome the cssnano z-index bug and how to update your gulp build task to fix the...
Read more >
When I added z-index: 999 value gets converted to an order
I never and cannot use 999 as a z-index . This is a project that was done by someone else and I'm doing...
Read more >
z-index - CSS: Cascading Style Sheets - MDN Web Docs
The z-index CSS property sets the z-order of a positioned element and its descendants or flex items. ... Change my z-index. z-index: 6....
Read more >
How does Z-index property work in CSS with Examples
The z-index property in CSS decides the stack order of the element like image or box or any character content or button etc....
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