Skip to content

Fix notebook preview header hidden by website header - #15017

Merged
cderv merged 5 commits into
mainfrom
fix/issue-14972
Oct 12, 2026
Merged

cderv merged 5 commits into
mainfrom
fix/issue-14972

Conversation

@cderv

@cderv cderv commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

On a website with a navbar, the notebook preview page (the *-preview.html behind an embedded notebook's source link) has two fixed-top bars: the site's #quarto-header and the preview's #quarto-embed-header. Both sit at top: 0 with the same z-index, and the site header comes later in the DOM, so it paints over the preview bar and hides the back link, the notebook title and the download link. The overlap has been there since notebook previews were introduced. The same happens with a sidebar (its collapsed toggle bar) or an announcement bar.

The overlap can't be fixed in CSS alone because the two bars don't know about each other's height: quarto-nav.js offsets the body by the site header height, while the embed template's inline script pads the content by the preview bar height only.

Fix

The notebook view postprocessor now moves #quarto-embed-header into #quarto-header as its last child and drops the bar's own fixed-top and headroom classes. The site navigation script already sizes the body offset from the header height (ResizeObserver) and runs Headroom on the whole header, so the embed template's inline script skips its own padding and Headroom setup in that case. This is the same placement approach as the draft alert and the dashboard navigation, which also insert into #quarto-header.

Pages without a site header (standalone documents, manuscripts) keep the bar fixed at the top as before.

Two alternatives were rejected: offsetting the two fixed headers separately, which fights Headroom's pin/unpin on each bar, and hiding the site navbar on previews, which loses site navigation.

Navigation landmark

The preview bar was a plain <div>, outside every landmark on pages without a site header, so screen reader users could not reach it through landmark navigation and axe reported it under region. It is now a <nav> labelled by the notebook title heading through aria-labelledby, so the landmark carries the notebook name without a new localized string. It is a <nav> rather than a <header> because on websites the bar sits inside #quarto-header, which is already the page banner.

Both changes touch the same element and template, so they go together here.

The CSS workaround suggested on #14972 is no longer needed once this lands.

Fixes #14972, fixes #14968

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR
  • ensured the present test suite passes
  • added new tests
  • created a separate documentation PR in Quarto's website repo and linked it to this PR
AI-assisted PR
  • AI tool used: Claude Code
  • Codebase grounding: local clone
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.

@posit-snyk-bot

posit-snyk-bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

cderv added 5 commits October 9, 2026 20:42
On a website with a navbar, the notebook preview page has two fixed-top
bars: the site's #quarto-header and the preview's #quarto-embed-header.
The site navbar paints over the preview bar, hiding the back link, the
notebook title and the download link (#14972).

The test checks that each of those controls is the topmost element at
its center. It fails on current main ("back link is covered by another
element"). The fixture uses stored notebook outputs so no kernel is
needed in CI.
On a website, the notebook preview page carries two fixed-top bars: the
site's #quarto-header and the preview's #quarto-embed-header. Both sit at
top: 0 and the site header paints over the preview bar, hiding the back
link, notebook title and download link (#14972).

The notebook view postprocessor now moves #quarto-embed-header into
#quarto-header as its last child and drops the bar's own fixed-top and
headroom classes. The site navigation script already sizes the body
offset from the header height (ResizeObserver) and runs Headroom on the
whole header, so the embed template's inline script skips its own
padding and Headroom setup in that case. Same placement approach as the
draft alert and dashboard navigation, which also insert into
#quarto-header.

Pages without a site header (standalone documents, manuscripts) keep the
bar fixed at the top as before.
The site header (#quarto-header) exists whenever a website has a navbar,
a sidebar (its collapsed toggle bar on narrow screens) or an
announcement, so the notebook preview header must stay uncovered in each
case. A standalone document has no site header and keeps the preview bar
fixed at the top; that path is checked too.

Each case also checks that the first notebook cell starts below the
header, so content is offset by the stacked header height.
The notebook preview bar holding the back link, notebook title and
download link was a plain <div>, outside every landmark on pages without
a site header, so screen reader users could not reach it through
landmark navigation, and axe reported it under `region` (#14968).

The bar is now a <nav> labelled by its own notebook title heading via
aria-labelledby, so the landmark carries the notebook name without a new
localized string. It is a <nav> rather than a <header> because on
websites the bar sits inside #quarto-header, which is already the page
banner.
@cderv
cderv merged commit c51ee2d into main Oct 12, 2026
93 of 95 checks passed
@cderv
cderv deleted the fix/issue-14972 branch October 12, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Website navbar hides the notebook preview header a11y: notebook preview header is outside any landmark

2 participants