Skip to content

[BUG] dcc.Markdown with a <dccLink children="..." /> does not render children #3951

Closed

Description

@KoolADE85

As of v4.4.0 dcc.Markdown does not render dccLinks properly when they use a children prop. The link is rendered using the href instead.

With this code:

dcc.Markdown(
    '<dccLink href="/page-2" children="Go to page 2" />',
    dangerously_allow_html=True,
),

Prior to v4.4.0:
Image

On v4.4.0:

Image

This is a result of upgrading react-jsx-parser (1.21.0 → 2.4.1) which changed its behaviour under the hood.

Activity

  1. self-assigned this
    on Aug 14, 2026
  2. added theissue type on Aug 14, 2026
  3. shahbhavya7 commented on Aug 20, 2026

    @shahbhavya7

    Hi @KoolADE85, I'd be happy to help out on this if it's still up for grabs, or if you'd like a second pair of hands on it. I can dig into the react-jsx-parser upgrade (1.21.0 → 2.4.1) and see how the children prop handling changed for JSX-like tags. Let me know if you're already working on a fix or if you'd like me to take a stab at it, happy to submit a PR either way.

  4. KoolADE85 commented on Aug 20, 2026

    @KoolADE85
    ContributorAuthor

    Hi @shahbhavya7, thanks for offering here!
    Do you have an approach in mind? Or a use-case that you are trying to resolve? As the issue is more nuanced than it appears, we have discussed a few approaches internally but haven't landed on anything yet. If you have an idea, we'd be happy to discuss here in the ticket ahead of a PR.

  5. shahbhavya7 commented on Aug 21, 2026

    @shahbhavya7

    Thanks for the context! I dug into how DccLink is wired up in Markdown.react.js it's registered as DccLink: props => <DccLink {...props} />, so it relies entirely on whatever props react-jsx-parser builds internally.

    My guess: in 1.21.0, a children="..." attribute on a self-closing tag was passed through as a normal string prop, so the spread picked it up. In 2.4.1, the parser likely now treats children as reserved and derives it only from actual nested JSX nodes, which are empty for a self-closing tag so it overrides/strips the attribute before our transform ever sees it.

    If that's right, a couple of possible fixes:

    1. In Markdown.react.js: in the DccLink transform, explicitly check for a raw children string on the parsed attributes (if react-jsx-parser exposes them separately) and merge it back in before spreading.

    2. Avoid relying on the children attribute at all update our docs/examples to use nested content instead (<dccLink href="...">Go to page 2</dccLink>) and treat children="..." as unsupported going forward, since it's relying on parser internals that clearly aren't guaranteed to stay stable.

    I lean toward option 2 as more robust long-term, but happy to prototype option 1 first if you'd rather preserve the existing API. Which direction do you want to explore in a PR?

  6. KoolADE85 commented on Aug 21, 2026

    @KoolADE85
    ContributorAuthor

    This appears to be an AI-generated comment that we won't engage with.
    We welcome your own thoughts on this issue, and it will be easier to come to a decision if we talk to each other directly rather than through an LLM. We'll be happy to consider your own ideas in your own words.

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

Metadata

Metadata

Assignees

Labels

P1needed for current cyclebugsomething brokensize: 1

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions