codesandbox / codesandbox/codesandbox-client

Broken HTML in embed mode

Open
#8,607 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
13.6k
Forks
2.4k
Avg merge
6d 19h
Merged PRs (30d)
2

Description

🐛 bug report

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project
    adheres to.
  • I have searched the issue tracker for an issue that matches the one I want
    to file, without success.

Description of the problem

In embed mode, the HTML is broken if one of the files contains $` (dollar sign followed by a backtick).
This seems to be breaking the HTML templating engine that is used in embed mode. The issue is only reproducible in embed.

How has this issue affected you? What are you trying to accomplish?

At MUI, we have a link to codesandbox for every demo in our docs using the define API.
Recently, we started using the embed mode because it's faster and it opens the file specified in the params (see https://github.com/mui/material-ui/pull/43618)

To Reproduce

Go to https://codesandbox.io/embed/infallible-lederberg-st3lrx?file=%2Findex.html

The text node visible in the side panel:

In the source, you can see that it breaks where the $` symbols should be:

Link to sandbox: https://codesandbox.io/p/sandbox/infallible-lederberg-st3lrx?file=%2Findex.html
Workarounds

Putting a space between $ and ` seems to be working: https://codesandbox.io/embed/blazing-platform-k5sk46?file=%2Findex.html

Your Environment

N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using the linked CodeSandbox in embed mode with a file containing the literal $` sequence. Trace the embed HTML templating path to find where that sequence is interpreted, then verify that it renders unchanged while other embed content remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.