-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Open
Labels
bugAn error in the Docusaurus core causing instability or issues with its executionAn error in the Docusaurus core causing instability or issues with its executionexternalThis issue is caused by an external dependency and not Docusaurus.This issue is caused by an external dependency and not Docusaurus.
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I'm using the latest version of Docusaurus.
- I have tried the
npm run clearoryarn clearcommand. - I have tried
rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages. - I have tried creating a repro with https://new.docusaurus.io.
- I have read the console error message carefully (if applicable).
Description
After upgrading to Docusaurus 3.9,
The root cause of this issue is that the upstream --docsearch-* CSS variables apply their dark/light mode based on the root site's data-theme attribute.
Ideally, we would be able to apply html[data-theme='dark'] variables while the search box is wrapped in the .navbar--dark class, but I don't think this is possible given the structure of the CSS (variables are being applied upstream at @docsearch/css).
Potential fixes:
- Duplicate the dark mode CSS variables for components within the
.navbar--darkclass. - Update variables upstream in
@docsearch/cssso we don't need to manually copy these values to the previous CSS rule.
Reproducible demo
https://codesandbox.io/p/devbox/xenodochial-ritchie-tk6g7f?file=%2Fdocusaurus.config.js
Steps to reproduce
- Enable Algolia search by setting
themeConfig.algoliain your Docusaurus config. - Set
themeConfig.navbar.style: darkin your Docusaurus config.
const config = {
themeConfig: {
algolia: { /** some algolia configuration */ },
navbar: {
style: 'dark'
}
}
}Expected behavior
Dark mode colour scheme in the navbar should apply regardless of light/dark mode value.
Actual behavior
Light mode colours apply, leading to limited readability in the search box.
Your environment
- Docusaurus version used: 3.9.2
- Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome 142
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): macOS Sequoia
Self-service
- I'd be willing to fix this bug myself.
Metadata
Metadata
Assignees
Labels
bugAn error in the Docusaurus core causing instability or issues with its executionAn error in the Docusaurus core causing instability or issues with its executionexternalThis issue is caused by an external dependency and not Docusaurus.This issue is caused by an external dependency and not Docusaurus.