[Firefox] data attributes are broken / not targeted for styling when building the site using theme-classic #9493
Labels
bug
An error in the Docusaurus core causing instability or issues with its execution
domain: theme
Related to the default theme components
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
tl;dr Firefox does not yet support
:has
(at least not by default)On Firefox, when I'm using the (default)
theme-classic
theme and locally serve the build files (npm run build && npm run serve
), custom data attributes selectors are not styled as described in the Docusaurus docs. When I serve the site via the development server (npm run start
), the custom data attributes selectors are styled properly. (I tested this in a fresh/new project)Also affects the dark/light mode toggle on the live docusaurus site:
#9493 (comment)
After looking around, I tracked the issue down to the built CSS:
After working with the built/optimized CSS, I was able to determine the rule was preventing the rest of the selectors in the combined rules from being evaluated:
This belongs to the Navbar Search component and it appears the problematic rule was introduced in this PR:
https://github.com/facebook/docusaurus/pull/9385/files#diff-b05b40971ea5fe3fbfdb4aee1fa6f1f4989d591465acbf2d45c84200223c36a8R12-R14
As a workaround, I can eject the component (
docusaurus swizzle @docusaurus/theme-classic Navbar/Search --eject
) and remove the rule (insrc/theme/Navbar/Search/styles.module.css
) to restore the expected data attribute styling functionality, but it would be nice if this was not necessary.Note: I did confirm the data-attributes were correctly being pulled from the query string and added to the document
html
:Reproducible demo
No response
Steps to reproduce
npx create-docusaurus@latest del-test classic --typescript
)e.g.
npm run build && npm run serve
)Expected behavior
custom data attributes should be styled as described in the Docusaurus docs when serving the built files and using the
theme-classic
themeActual behavior
custom data attributes are not styled as described in the Docusaurus docs when serving the built files and using the
theme-classic
themeYour environment
Self-service
The text was updated successfully, but these errors were encountered: