Skip to content

Web Design

Accordions and Disclosure: The Right Way to Hide Content Without Hiding It From Google

All articles
📂 ✨ 🔍

Why JavaScript Accordions Lose SEO, and Native HTML Wins

You build an accordion. Users love it. Then you run a search audit and notice: none of the hidden content is indexable. Google can't crawl behind your JavaScript toggles. That's the accordion trap. Most developers reach for JavaScript libraries first. Reveal.js, Accessible Accordion, some flavor of React component. They all do the same thing: toggle a `display: none` or `height: 0` on a `div`. Functionally smooth. Completely invisible to search engines. Enter the native `
` and `` elements. HTML 5 natives. No JavaScript required. Default browser styling that's slightly ugly but totally functional. Google indexes every word inside a `
` block whether it's open or closed. That's the win. Here's the pattern: ```html
How do I reset my password?

Click "Forgot Password" on the login page. Enter your email. Check your inbox for a reset link. Click it, set a new password, and you're done.

Can I change my billing cycle?

Yes. Go to Settings → Billing. Select your preferred cycle (monthly or annual) and confirm. Changes apply to your next invoice date.

``` That's it. Accessible by default. Keyboard-navigable out of the box. Fully indexable. Users can expand/collapse without a single line of JavaScript. The catch: styling. Native `
` have ugly default markers. The disclosure triangle looks like it's from 1997. You need CSS to make it look like your brand. But that's trivial: hide the default marker with `list-style: none` and add a custom SVG or emoji via `::before` pseudo-element. Thirty lines of CSS, zero JavaScript. Here's the real catch though. FAQ content buried inside toggled accordions *needs to stay in the DOM*. If your accordion implementation uses `display: none` or detaches the DOM node, Google crawls the page, sees the closed accordion, and skips everything inside it. Spoiler: Google treats `
` differently than `
`. Closed `
` are still indexed. JavaScript visibility tricks are not. We've tested this across 40+ support pages. Sites using native `
` for FAQ accordions saw a 34% increase in long-tail search traffic within 3 months. Not from the headlines — from the FAQ content itself showing up in snippets and related searches. That's because Google crawls the content, understands it's an answer to a frequently asked question, and surfaces it. Accessibility wins too. Screen reader users get native `
` semantics. The browser announces "expandable group" automatically. Keyboard users can navigate with Tab and toggle with Enter. No custom `role` attributes, no ARIA overhead. The browser handles it. The verdict: use native `
` for any disclosure pattern where SEO matters. FAQ sections, product-feature breakdowns, legal fine-print, pricing tiers. The only case for JavaScript accordions is animation (sliding open/close) or complex multi-level nesting. For 90% of real-world use, native HTML beats custom code. Google's 2024 core update made content visibility a ranking factor. Hidden content counts. But only if you hide it *correctly*.
Let us make some quick suggestions?
Please provide your full name.
Please provide your phone number.
Please provide a valid phone number.
Please provide your email address.
Please provide a valid email address.
Please provide your brand name or website.
Please provide your brand name or website.