@@ -153,6 +153,42 @@ test.describe("interactive components work cross-browser", () => {
153153 expect ( textContent ) . toContain ( "MARKER_MERMAID_REQUEST" ) ;
154154 } ) ;
155155
156+ test ( "'View as Markdown' dialog opens at consistent size across engines" , async ( {
157+ page,
158+ } ) => {
159+ await page . goto ( EVERYTHING ) ;
160+
161+ // Open the copy-md dropdown by clicking its caret toggle, then click
162+ // the "View as Markdown" menu item. The dialog opens as a modal
163+ // <dialog>, sized by CSS.
164+ const toggle = page . locator ( ".copy-md-toggle" ) . first ( ) ;
165+ if ( await toggle . count ( ) === 0 ) {
166+ test . skip ( true , "no copy-md dropdown on this page (consumer didn't wire it)" ) ;
167+ }
168+ await toggle . click ( ) ;
169+ const viewBtn = page . locator ( 'button[data-action="view"]' ) . first ( ) ;
170+ await viewBtn . click ( ) ;
171+
172+ const dialog = page . locator ( ".copy-md-dialog" ) . first ( ) ;
173+ await expect ( dialog ) . toBeVisible ( { timeout : 5_000 } ) ;
174+ const box = await dialog . boundingBox ( ) ;
175+ expect ( box , "dialog has no bounding box" ) . not . toBeNull ( ) ;
176+
177+ // Regression guard for a Safari-specific bug where the modal <dialog>
178+ // resolved width:100% against its intrinsic-content containing block
179+ // (collapsing the dialog to <pre> width, ~300px) instead of the
180+ // viewport (Chrome/Firefox behavior). CSS now sets width directly.
181+ //
182+ // At the cross-browser desktop viewport (1280px), the dialog should
183+ // render at min(900px, 90vw) = 900px. Threshold 600px is generous
184+ // enough to absorb sub-pixel rounding while still catching the
185+ // collapsed-to-content failure mode (which produces widths < 400px).
186+ expect (
187+ box ! . width ,
188+ `dialog width ${ box ! . width } px is too small — modal <dialog> likely collapsed to content` ,
189+ ) . toBeGreaterThan ( 600 ) ;
190+ } ) ;
191+
156192 test ( "theme toggle adds html.dark class" , async ( { page } ) => {
157193 await page . goto ( EVERYTHING ) ;
158194 // Force-toggle via the same class the Hextra theme button sets, so this
0 commit comments