no-mobile-navbar-backdrop-filter
Disallow unsafe navbar backdrop filters that bleed into the Docusaurus mobile sidebar.
Targeted pattern scopeโ
This rule targets backdrop-filter and -webkit-backdrop-filter declarations on selectors that style the Docusaurus navbar itself, such as .navbar and .navbar--fixed-top.
The rule ignores safe reset values like none, initial, and unset, and it also allows navbar blur that is explicitly guarded behind Docusaurus's desktop breakpoint with @media (min-width: 997px).
What this rule reportsโ
This rule reports navbar blur declarations that can affect the mobile sidebar.
Docusaurus renders the mobile sidebar inside the <nav> element, so a blur applied to the navbar can also affect the sidebar and its backdrop when the site collapses below the default desktop breakpoint.
Why this rule existsโ
This is one of the easiest ways to accidentally break Docusaurus on mobile.
A translucent blurred navbar often looks fine on desktop, but the same rule can make the mobile sidebar render incorrectly, blur the wrong surface, or become harder to interact with.
The safest default is to keep navbar blur off the mobile navbar entirely and only opt into it above the desktop breakpoint.
โ Incorrectโ
.navbar {
backdrop-filter: blur(16px);
background: rgb(20 20 20 / 70%);
}
โ Correctโ
@media (min-width: 997px) {
.navbar {
-webkit-backdrop-filter: blur(16px);
backdrop-filter: blur(16px);
background: rgb(20 20 20 / 70%);
}
}
Behavior and migration notesโ
- This rule checks both
backdrop-filterand-webkit-backdrop-filter. - It treats
@media (min-width: 997px)as the safe desktop guard because that matches Docusaurus's default desktop navbar breakpoint. - The rule is report-only because automatically moving the blur to another selector or wrapping it in a media query would be unsafe.
Additional examplesโ
โ Correct โ apply the effect to a different elementโ
.heroBanner {
backdrop-filter: blur(12px);
}
โ Correct โ explicit mobile resetโ
.navbar-sidebar--show {
backdrop-filter: none;
}
Stylelint config exampleโ
import { docusaurusPluginConfigs } from "stylelint-plugin-docusaurus";
export default {
...docusaurusPluginConfigs["docusaurus-recommended"],
rules: {
...docusaurusPluginConfigs["docusaurus-recommended"].rules,
"docusaurus/no-mobile-navbar-backdrop-filter": true,
},
};
When not to use itโ
Disable this rule if your site has swizzled the navbar layout or otherwise changed the mobile DOM structure enough that navbar blur is known to be safe below the default Docusaurus breakpoint.
Package documentationโ
Docusaurus package documentation:
Rule catalog ID: R004