You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The preview HTML generated by the experimental Sandpack bundler doesn't include a DOCTYPE, causing browsers to use Quirks Mode.
To reproduce, go to any page with previews (e.g. /learn)
Firefox (v111.0) Open console and see the warning about Quirks Mode
Chrome (v111.0.5563.110) Open dev tools, select an iframe, in console run document.compatMode, which returns "BackCompat"
Safari (v16.3) Same as Chrome
When using the experimental bundler, the HTML in the iframes is minimal, e.g.
<html><head><title>Sandpack Preview</title><metacharset="utf-8"><styleid="/styles.css-css" type="text/css"><!-- styles omitted --></style></head><body><divid="root"><div><h1>Welcome to my app</h1><button>I'm a button</button></div></div></body></html>
Running the code locally, commenting out the bunderUrl in src/components/MDX/Sandpack/SandpackRoot produces fuller HTML:
Despite the length of HTML produced by the old bundler, the only major things missing seem to be doctype and viewport.
Presumably this is a bug in Sandpack's new bundler, which was added to the React docs in #4458
That PR mentions expected performance improvements, so this might be a temporary trade off between performance and compatibility. I didn't see Quirks Mode mentioned anywhere, though, and seemed worth raising an issue.
The text was updated successfully, but these errors were encountered:
The preview HTML generated by the experimental Sandpack bundler doesn't include a DOCTYPE, causing browsers to use Quirks Mode.
To reproduce, go to any page with previews (e.g.
/learn
)document.compatMode
, which returns "BackCompat"When using the experimental bundler, the HTML in the iframes is minimal, e.g.
Running the code locally, commenting out the
bunderUrl
insrc/components/MDX/Sandpack/SandpackRoot
produces fuller HTML:Despite the length of HTML produced by the old bundler, the only major things missing seem to be doctype and viewport.
Presumably this is a bug in Sandpack's new bundler, which was added to the React docs in #4458
That PR mentions expected performance improvements, so this might be a temporary trade off between performance and compatibility. I didn't see Quirks Mode mentioned anywhere, though, and seemed worth raising an issue.
The text was updated successfully, but these errors were encountered: