Skip to content

Custom elements get their slot properties removed when evaluated by the shared JSX runtime #16891

Description

@randomguy-2650

Astro Info

Astro                    v6.3.8 [*]
Node                     v24.15.0
Package Manager          pnpm
Output                   static
Integrations             @astrojs/mdx

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

According to the custom elements spec, all custom elements must be defined with a tag name that includes a hyphen, to avoid colliding with future HTML elements.

@astrobot-houston created #16819 to resolve #16273, but this change causes every custom element to be “claimed” by Astro as an Astro component, therefore preventing it from being hydrated properly on the client.

Because the shared JSX runtime assumes the custom element is an Astro component or something, it strips the slot property and not sure what else (see packages/astro/src/runtime/server/jsx.ts line 96–97 to see the hyphen stripping).

This might happen in JSX files too with the React/Preact integration, but I’ve mainly tested it with the MDX integration.

*: This bug started in v6.3.7, versions before that, so versions ≤ 6.3.6 don’t have this bug. The StackBlitz uses the latest version as of the time of creating it, v6.4.1, and it still isn’t fixed in this version.

#16273 complains about custom element SSR stuff, but SSR isn’t really compatible with web components, as it is still very buggy.

What's the expected result?

Custom elements must be parsed by the HTML renderer, not the Astro shared JSX runtime (i.e., revert #16819 if plausible).

Screenshot of the info icon having its slot property removed, causing misalignment and being incorrectly coloured with the text colour:

Screenshot of a callout with a miscoloured and misaligned icon

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-hmcwynmc

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P4: importantViolate documented behavior or significantly impacts performance (priority)pkg: astroRelated to the core `astro` package (scope)pkg: mdxIssues pertaining to `@astrojs/mdx` integration

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions