Skip to content

Articles dropdown starts with an empty divider (Bootstrap 5) #3033

Open

Description

@schloerke

With Bootstrap 5, when the first articles: section has a navbar: heading, the Articles dropdown starts with an empty divider. This is the same problem as #1319, which was fixed for Bootstrap 4 only.

template:
  bootstrap: 5

articles:
- title: Working with models
  navbar: Working with models
  contents:
  - prompt-design
  - structured-data
  - tool-calling
- title: Building with ellmer
  navbar: Building with ellmer
  contents:
  - programming
  - streaming-async
  - otel

Articles dropdown with an empty divider above the first heading

The generated menu:

<ul class="dropdown-menu" aria-labelledby="dropdown-articles"><li><hr class="dropdown-divider"></li>
  <li><h6 class="dropdown-header" data-toc-skip>Working with models</h6></li>
  ...

navbar_articles() adds a separator before every section heading, including the first one:

pkgdown/R/navbar.R

Lines 214 to 219 in f69b62a

c(
if (!is.null(section$navbar)) {
list(menu_separator(), menu_heading(section$navbar))
},
menu_links(vig$title, vig$href)
)

The empty space also matters because .dropdown-menu has max-height: 280px. In the screenshot, the last link ("Monitoring with OpenTelemetry") is pushed below the fold and only shows if you scroll the menu.

A possible fix is to skip the separator for the first section, for example by passing index into the check: if (!is.null(section$navbar)) list(if (index > 1) menu_separator(), menu_heading(section$navbar)).

Seen with pkgdown 2.2.1 and on main.

Activity

  1. schloerke commented on Oct 23, 2026

    @schloerke
    Author

    With the first divider removed...

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions