Skip to content

Markdown code-block copy button doesn't work in an accordion #6894

@yairchu

Description

@yairchu

Describe the bug

The button to copy text from a markdown code block doesn't work when the markdown cell is in an accordion:

Image

A possible hint on the cause is that the markdown in the accordion also looks dim, perhaps hinting that it is in a "disabled" mode? However it still offers the button on hover and it appears to click so one would expect it to still copy the contents.

Will you submit a PR?

  • Yes

Environment

{
  "marimo": "0.17.0",
  "editable": true,
  "location": "/Users/yairchu/dev/marimo/marimo",
  "OS": "Darwin",
  "OS Version": "24.6.0",
  "Processor": "arm",
  "Python Version": "3.12.9",
  "Locale": "en_US",
  "Binaries": {
    "Browser": "140.0.7339.134",
    "Node": "v22.13.0"
  },
  "Dependencies": {
    "click": "8.2.1",
    "docutils": "0.21.2",
    "itsdangerous": "2.2.0",
    "jedi": "0.19.2",
    "markdown": "3.7",
    "narwhals": "2.3.0",
    "packaging": "25.0",
    "psutil": "7.0.0",
    "pygments": "2.19.1",
    "pymdown-extensions": "10.16.1",
    "pyyaml": "6.0.2",
    "starlette": "0.46.1",
    "tomlkit": "0.13.2",
    "typing-extensions": "4.13.2",
    "uvicorn": "0.34.0",
    "websockets": "15.0.1"
  },
  "Optional Dependencies": {
    "duckdb": "1.4.1",
    "openai": "2.3.0",
    "loro": "1.5.0",
    "ruff": "0.14.0",
    "sqlglot": "27.26.0"
  },
  "Experimental Flags": {
    "performant_table_charts": true,
    "chat_modes": true,
    "multi_column": true,
    "cache_panel": true
  }
}

Code to reproduce

Single cell notebook example:

import marimo as mo


def box(text):
    return mo.md(
        f"""
        {text}:
        ```
        {text}
        ```
        """
    )


mo.vstack(
    [
        box("Box A: Copying from this box works"),
        mo.accordion(
            {
                "Accordibox": mo.vstack(
                    [box("Box B: Copying from this box doesn't work")]
                )
            },
            lazy=True,
        ),
    ]
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions