A mega menu can look perfect, open on hover, pass every accessibility check, and still give Google zero links. If the dropdown is built in React and only renders its panel when it opens, the links aren't in the HTML your server sends, and Googlebot never opens the menu to make them appear. I found this on my own site this week: the header listed nine service pages, and the live home page linked none of them from the header.

This post covers how to check your own menu in 30 seconds, which popular React menu components behave this way (I tested Radix, shadcn/ui's base and Headless UI), and the fix I shipped, with its real cost in DOM size.

The short answer

  • Does Google crawl mega menu links? Only if they're real <a href> links in the page's HTML. Google renders JavaScript, but it doesn't hover or click, so a panel that renders only on hover or click never appears for it.
  • Which menus are affected? In my test, the closed state of Radix NavigationMenu, Radix DropdownMenu, Headless UI Menu, Popover and Disclosure, and any {open && <ul>} pattern, all rendered 0 of 2 links.
  • The fix: keep the links in the HTML while the menu is closed. Use forceMount (Radix), unmount={false} (Headless UI), a CSS-hidden panel, or a hidden list of plain links.

What I found on my own site

knowledgemarkg.com runs on Next.js. In November I replaced the header with a mega menu: Services, Free Tools and Blog, each with a two-column dropdown. The label is a link to the section page, and a chevron button opens the panel. It works well for people.

While checking why a few service pages were slow to get indexed, I fetched the live home page with curl and counted the links to /services/. There were 4, all from the footer and the page body. The header's dropdown links to the nine service pages weren't in the HTML at all, because the component rendered the panel like this:

// The pattern most hand-rolled menus use export function MegaMenu({ menu }) { const [open, setOpen] = useState(false); return ( <div onMouseEnter={() => setOpen(true)} onMouseLeave={() => setOpen(false)}> <Link href={menu.href}>{menu.label}</Link> <button aria-expanded={open} onClick={() => setOpen(!open)}>▾</button> {open ? <Panel menu={menu} /> : null} {/* closed = nothing in the HTML */} </div> ); } 

When the panel is closed, React renders null. That's the state the server renders, so that's the HTML Google gets.

Check your own menu in 30 seconds

Don't use the browser's Elements panel for this. By the time you look, you've probably hovered the menu, and DevTools shows the live DOM, not what the server sent. Use View Source (Ctrl+U), or curl:

# What the server actually sends (no JavaScript run, no clicks) curl -s -A "Mozilla/5.0" https://example.com/ | grep -o 'href="/services/[^"]*"' | sort -u # Count them curl -s -A "Mozilla/5.0" https://example.com/ | grep -o 'href="/services/[^"]*"' | sort -u | wc -l 

Swap /services/ for any path your menu links to. If a page in your dropdown doesn't show up, it isn't in the server HTML. Two more checks are useful:

  • Search Console → URL Inspection → View crawled page → HTML. That's the HTML after Google rendered it. If the links aren't there either, Google didn't see them.
  • Compare with the sitemap. A page that is in your sitemap but linked from nowhere visible to a crawler often ends up in "Discovered - currently not indexed". I wrote about the difference in Crawled vs Discovered - currently not indexed.

Why Google doesn't see links in a closed menu

Two parts of Google's documentation explain it:

  • Google's crawlable-links guide says it can generally crawl a link only if it's an <a> element with an href. Links inserted with JavaScript count too, as long as they end up as that same markup.
  • Its lazy-loading guide says plainly that Google Search does not interact with your page: no scrolling, no clicking. Hover is not mentioned at all.

So rendering isn't the issue. Google does run your JavaScript. The issue is that nothing ever sets open to true during rendering. Content that waits for a user action never exists for the crawler.

This is different from content that's on the page but hidden with CSS, like a collapsed accordion. Those links are in the HTML. The question for an accordion is how much weight hidden text gets. For a conditionally rendered menu, there's nothing there to weigh.

I tested the popular React menu components

To see whether this is just my hand-rolled menu, I rendered each component on the server with React's renderToString, closed, with the same two <a href="/services/..."> links inside, and counted the links in the output. Versions: React 19.3.1, @radix-ui/react-navigation-menu 1.4.1, @radix-ui/react-dropdown-menu 2.2.1, @headlessui/react 2.2.10.

Component (closed) Links in server HTML
Radix NavigationMenu 0 of 2
Radix NavigationMenu, Content forceMount 2 of 2
Radix DropdownMenu 0 of 2
Headless UI Menu 0 of 2
Headless UI Popover 0 of 2
Headless UI Popover, unmount={false} 2 of 2
Headless UI Disclosure 0 of 2
Hand-rolled {open && <ul>} 0 of 2
Native <details><summary> 2 of 2
Panel always rendered, hidden with CSS 2 of 2

The test was just this, once per component:

const { renderToString } = require("react-dom/server"); // ...build each menu closed, with two <a href="/services/..."> inside... const html = renderToString(menu); console.log((html.match(/href="\/services/g) || []).length, "/ 2"); 

shadcn/ui's Navigation Menu and Dropdown Menu are built on these Radix components, so I'd expect the same result, but I tested the Radix packages, not the shadcn copies. Server-rendering the closed state like this is a fair stand-in for the first HTML a crawler gets, but it isn't Googlebot itself. Use the URL Inspection check above to confirm what Google saw on your site.

None of this is a bug in those libraries. Unmounting closed popups is a sensible default for dropdowns full of actions like "Delete" or "Sign out". It just isn't what you want for site navigation.

Four ways to fix it

1. Keep the panel mounted (library option)

If you use a library, it probably already has a switch:

// Radix NavigationMenu (and shadcn/ui's NavigationMenu, which wraps it) <NavigationMenu.Content forceMount> {links} </NavigationMenu.Content> // Headless UI v2 <PopoverPanel unmount={false}> {links} </PopoverPanel> 

With Headless UI, unmount={false} renders the panel with hidden and display:none, and the links are in the HTML. This is the smallest change if your panel is light.

2. Always render the panel, hide it with CSS

Render the panel every time and toggle visibility with a class (hidden / group-hover:block, or visibility plus opacity for a transition). It's simple, but every icon, description and decoration in the panel is now in every page's DOM, multiplied by the number of dropdowns. On a mega menu that adds up.

3. Render a light, hidden list of the same links (what I did)

My panels have an icon tile and a description per link, plus gradient decorations. Rendering all three menus fully on every page would have added a few hundred elements, and keeping the home page's DOM small was something I'd already worked on. So the closed state renders one plain link per destination inside a hidden element, and the full panel still only renders when opened:

{open ? ( <Panel menu={menu} /> ) : ( // Closed: the same destinations as plain links, so they are in the server HTML. // One element per link - the heavy panel (icons, descriptions) still renders only when opened. <div id={`nav-panel-${menu.key}`} hidden> {menu.items.map((item) => ( <Link key={item.href} href={item.href} prefetch={false}> {item.label} </Link> ))} </div> )} 

The id matches the button's aria-controls, so the button always points at a real element. prefetch={false} stops Next.js from trying to prefetch these links, which matters less for hidden links, but there's no reason to load them.

The result: the live home page went from 4 to 11 unique links to /services/, and its body grew from 1,122 to 1,159 elements (counted from the served HTML, scripts excluded). That's 37 elements for every link in three menus.

These hidden links go to exactly the same pages a visitor gets by opening the menu. That's the line to stay on: don't add destinations or keyword-stuffed anchor text that people can't reach.

4. Use <details>, or make the parent link do the work

A native <details><summary> keeps its content in the HTML when closed and needs no JavaScript. It works well for mobile menus. Whatever you choose, make the top-level label a real link to a hub page (/services, /tools) that links to every child page in plain HTML. Then even a fully JavaScript-only menu leaves a crawl path.

What the fix did, and didn't do

On the day I deployed, I checked the six service pages that had been slow to index, using Search Console's URL Inspection. Five were already indexed, before Google could have seen the fix. Google had found them through the footer and the sitemap. One, website redesign, is "Crawled - currently not indexed", which means Google fetched it and decided not to index it. A missing link can't explain that, so the next step for that page is better content, not more links.

So I'm not claiming this fix got pages indexed. What it does is make the header links real for every crawler. On a site with nine service pages, that's nine links from every page instead of zero. That's the main way a small site tells Google which pages matter. If the menu is the only place a page is linked, it's the difference between being found and not.

Quick checklist

  1. curl your home page (or Ctrl+U) and grep for a path that only your dropdown links to.
  2. Missing? Find where the panel renders null or {open && ...} when it's closed.
  3. Fix it with forceMount / unmount={false}, a CSS-hidden panel, or a light hidden list of the same links.
  4. Check the DOM size before and after. Lighthouse flags very large DOMs.
  5. Confirm in Search Console: URL Inspection → View crawled page → HTML.
  6. Make sure every top-level menu label links to a hub page that lists its children.

Related reading from my site's own clean-up: PageSpeed 100 on mobile with Next.js: what worked and reducing unused JavaScript in Next.js. If you'd rather have someone check your site's crawlability, the free website audit looks at links, speed and indexing in one pass.

FAQ

Does Google crawl links in a mega menu or dropdown menu?

Yes, if they are real <a href> links in the page's HTML. If the menu only renders its panel after a hover or click, the links don't exist for Google, because Google renders JavaScript but doesn't interact with the page. Check with View Source or curl, not the DevTools Elements panel.

Are mega menus bad for SEO?

Not by themselves. The common problem is technical: many React and JavaScript menus don't render their links until they are opened, so crawlers get no links at all. A menu whose links are in the HTML is a normal, crawlable navigation.

Does Radix or shadcn/ui NavigationMenu render links for SEO?

In my test (Radix NavigationMenu 1.4.1, server-rendered with React 19), the closed menu rendered 0 of 2 links. Adding forceMount to NavigationMenu.Content rendered both. shadcn/ui's Navigation Menu wraps the same Radix component.

Does Headless UI render menu items when closed?

Not by default. In my test, Headless UI 2.2.10 Menu, Popover and Disclosure all rendered 0 of 2 links when closed. PopoverPanel with unmount={false} rendered both, hidden with display:none.

Does Google index links hidden with CSS or the hidden attribute?

Links hidden with CSS or the hidden attribute are still in the HTML, so Google can read them; that's the difference from a menu that isn't rendered at all. Keep hidden links to the same destinations users reach by opening the menu.

How do I check if Googlebot can see my menu links?

Fetch the page without a browser (curl, or Ctrl+U for View Source) and search for a URL only your dropdown links to. Then confirm in Google Search Console with URL Inspection, View crawled page, HTML, which shows the HTML after Google rendered it.

Will adding hidden menu links make my page slower?

Slightly, so keep them light. On my home page, a plain hidden link per destination for three menus took the body from 1,122 to 1,159 elements. Rendering the full panels with icons and descriptions would have cost much more.

Originally published on knowledgemarkg.com.