Skip to content

Citation BibTeX copy button is shown but does nothing with code-copy: false #15207

Closed

Description

@cderv

With code-copy: false, the BibTeX block in the citation appendix still gets a copy button, but clicking it does nothing.

---
title: "Citation BibTeX block without code-copy"
author: "Author name"
date: "2025-01-01"
format: html
citation: true
code-copy: false
---

code-copy: false correctly removes the copy button from the document code blocks, and it also means clipboard.js is not loaded and the copy script is not added to the page. However the citation appendix adds its copy button and scaffold to the BibTeX block unconditionally, without looking at code-copy:

const bibTexDiv = createCodeBlock(doc, cite.bibtex, "bibtex");
bibTexDiv.classList.add(kQuartoCiteBibtexClass);
const outerScaffold = doc.createElement("div");
outerScaffold.classList.add("code-copy-outer-scaffold");
outerScaffold.appendChild(bibTexDiv);
contentsDiv.appendChild(outerScaffold);
const copyButton = createCodeCopyButton(doc, format);
outerScaffold.appendChild(copyButton);

while the option is only checked for the regular code blocks and the clipboard dependency:

if (featureDefaults.copyCode) {
options.copyCode = format.metadata[kCodeCopy] !== false;
} else {
options.copyCode = format.metadata[kCodeCopy] || false;
}

So the button is rendered with its icon, but nothing is wired to it. This has been the case since the BibTeX block was made copyable, it is not a regression. It is more visible now since #14387 moved the button inside the BibTeX block.

We could resolve code-copy the same way in the appendix and only add the button when it is enabled, so the BibTeX block behaves like the other code blocks of the document.

Workaround

Hide the button with some CSS, for example in a styles.css file referenced with css: styles.css:

#quarto-citation .code-copy-button {
  display: none;
}

Or keep code-copy enabled (true or the default hover) if a working copy button on code blocks is fine for the document.

Related: #13669, #14387

Activity

  1. added
    bugSomething isn't working
    htmlIssues with HTML and related web technology (html/css/scss/js)
    on Oct 27, 2026
  2. added this to the v1.11 milestone on Oct 27, 2026
  3. self-assigned this
    on Oct 27, 2026
  4. added a commit that references this issue on Oct 27, 2026
    210691f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcitationsIssues with citationshtmlIssues with HTML and related web technology (html/css/scss/js)

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions