Skip to content

fix(web-components): fix markdown truncation and HTML attachment modal issues#697

Merged
todti merged 5 commits into
mainfrom
fix/html-markdown-attachment-preview
Jun 11, 2026
Merged

fix(web-components): fix markdown truncation and HTML attachment modal issues#697
todti merged 5 commits into
mainfrom
fix/html-markdown-attachment-preview

Conversation

@todti

@todti todti commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes two bugs related to attachment preview rendering:

#679 — Markdown render truncated

  • MarkdownPreview was reusing .html-attachment-preview CSS which applies flex: 1; min-height: 0 to the iframe — this caused the CSS flex layout to override the dynamically-measured height attribute, capping the iframe at the flex container's height instead of the full content height
  • Added a dedicated .markdown-attachment-preview class (no flex constraints) so the measured height is respected
  • Changed height="100%" fallback (before content loads) to no attribute — browser default (~150 px) is more sensible in a block container than 100% of an undefined parent
  • Changed overflow: hiddenoverflow-y: auto on .modal-data-component so tall markdown content scrolls within the modal

#692 — HTML attachment rendering issues in fullscreen

  • Wired .attachmentViewStack / .attachmentViewPane into the modal's flex height chain so HtmlPreview's height: 100% iframe fills the fullscreen modal instead of collapsing to the browser default ~150 px
  • TrAttachment: passed current showPreview state when opening the modal so HTML/markdown attachments open in the same mode (preview vs source code) the user was already viewing, instead of always defaulting to source code
  • HtmlPreview: changed blob MIME type from text/html to text/html; charset=utf-8 — since response.text() always decodes as UTF-8 and DOMPurify strips all <meta charset> tags, the blob bytes are already UTF-8; the explicit charset prevents the iframe from guessing a wrong encoding if any charset hint survives sanitization

Note: fully fixing garbled Chinese text for GBK-encoded files would require refactoring fetchAttachment to detect and decode using the file's actual charset rather than defaulting to UTF-8 — that's a separate issue.

Closes #679
Related to #692

…l issues

- MarkdownPreview: use dedicated CSS class without flex height constraints
  so the dynamically-measured iframe height attribute is respected (#679)
- MarkdownPreview: drop height="100%" fallback before content loads;
  browser default height is more sensible in a block container
- Modal: change overflow: hidden → overflow-y: auto on modal-data-component
  so tall markdown content can be scrolled within the modal (#679)
- Modal: wire .attachmentViewStack/.attachmentViewPane into the flex height
  chain so HtmlPreview fills the fullscreen modal instead of collapsing
  to the browser default ~150px (#692)
- HtmlPreview: set blob MIME to text/html; charset=utf-8 to prevent the
  iframe from guessing encoding from stale meta tags (#692)
- TrAttachment: pass current preview state when opening the modal so
  HTML attachments open in preview mode, not source-code mode (#692)
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Allure Report Summary

Name Duration Stats New Flaky Retry Report
Allure 3 Report 37m 5s Passed tests 8457   Broken tests 2   Skipped tests 15   Unknown tests 27 21 0 0 View
Allure 3 GitHub actions run (2026-06-11T08:56:11.813Z) 37m 5s Passed tests 8457   Broken tests 2   Skipped tests 15   Unknown tests 27 21 0 0 View
My Dashboard 37m 5s Passed tests 8457   Broken tests 2   Skipped tests 15   Unknown tests 27 21 0 0 View

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Allure perf metrics

Generated at: 2026-06-11T09:12:12.641Z

Phase Count Total Avg Min Max
restoreState.total 1 2399.2 ms 2399.2 ms 2399.2 ms 2399.2 ms
restoreState.dump 3 2398.7 ms 799.6 ms 759.2 ms 847.4 ms
restoreState.attachments 3 1717.1 ms 572.4 ms 542.0 ms 589.2 ms
restoreState.storeRestore 3 212.4 ms 70.8 ms 56.0 ms 84.3 ms
generate.total 1 606108.2 ms 606108.2 ms 606108.2 ms 606108.2 ms
generate.plugins.done 1 5962.1 ms 5962.1 ms 5962.1 ms 5962.1 ms
publish.upload.total 1 338931.4 ms 338931.4 ms 338931.4 ms 338931.4 ms
summary.generate 2 17.5 ms 8.7 ms 5.4 ms 12.0 ms
generate.plugin.done.agent 1 0.2 ms 0.2 ms 0.2 ms 0.2 ms
generate.plugin.done.awesome 1 4970.7 ms 4970.7 ms 4970.7 ms 4970.7 ms
generate.plugin.done.dashboard 1 760.5 ms 760.5 ms 760.5 ms 760.5 ms
generate.plugin.done.log 1 2.5 ms 2.5 ms 2.5 ms 2.5 ms
generate.plugin.done.testops 1 225.9 ms 225.9 ms 225.9 ms 225.9 ms
publish.upload.plugin.awesome 1 331515.9 ms 331515.9 ms 331515.9 ms 331515.9 ms
publish.upload.plugin.dashboard 1 1783.4 ms 1783.4 ms 1783.4 ms 1783.4 ms

Artifacts: allure-perf-metrics

@kieran-ryan

kieran-ryan commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Delighted to see this - thank you for implementing! 🙌 Had been having a quick look on the same myself to understand the desired outcome (https://github.com/kieran-ryan/allure3/tree/fix/preview-render-height) and popping some additional aspects that should complete the preview functionality - having built from your branch - hope helpful!

Expand should open in preview mode by default

Screenshot 2026-06-09 at 15 19 00

Should support markdown syntax highlighting - looks like may have been a regression within a release

Screenshot 2026-06-09 at 15 37 00

Markdown preview is scrollable beyond the end of the content of the document in expand mode

Screenshot 2026-06-09 at 15 19 43

Vertical padding missing on inline preview

Screenshot 2026-06-09 at 15 18 31

- Always open modal in preview mode for previewable attachments (HTML/md),
  regardless of current inline toggle state
- Fix markdown syntax highlighting: prism-markup must be imported before
  prism-markdown since the latter calls Prism.languages.extend('markup')
- Add vertical padding to markdown-attachment-preview (was 0 top/bottom)
- Fix modal layout chain: make attachmentViewPane a flex column so
  html-attachment-preview fills the fullscreen modal correctly
- Reset html/body margin in markdown iframe so scrollHeight is accurate
  and preview does not scroll past visible content
@kieran-ryan

kieran-ryan commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Retested and adding below observations. Using macOS with Safari in case relevant - though might retry again to ensure local build is clean.

Now observe the vertical padding on the inline preview - nice!

Screenshot 2026-06-09 at 18 23 59

Syntax highlighting is visible on the code blocks with this theme, though remains absent from the headers - which was available in earlier releases. Perhaps is a stylistic or thematic choice? Mentioning in case.

Screenshot 2026-06-09 at 18 22 01

Expanded preview mode continues to open as raw source code by default; and the scroll height when changing to preview mode continues to extend and allow scrolling beyond the content.

One additional enhancement (which perhaps could be a separate issue if requires some work) would to be provide syntax highlighting on code blocks in preview mode.

image

todti added 2 commits June 9, 2026 19:05
- Fix expand button opening in source code: the actual expand icon lives
  in TrAttachmentInfo, not TrAttachment — pass preview: isPreviewable
  and previewable: isPreviewable there (and in the item-change effect)
- Fix markdown preview scrolling past content: vertical padding on the
  container div caused the iframe (sized to content height) to overflow
  the container, making the last 16px scrollable past actual content.
  Move vertical padding inside the iframe body so getIframeContentHeight
  includes it in the measurement and container overflow is eliminated.

@kieran-ryan kieran-ryan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Can confirm working well from local build.

  • Vertical padding on inline preview
  • Expand opens in preview mode by default
  • Syntax highlighting on markdown
  • Scroll in expand mode matches content height

Syntax highlighting of code blocks within rendered markdown desirable, though can be a standalone issue if to be addressed separately.

Also closes #431.

Looking forward to the fix release - thank you! 🚀

@todti todti merged commit 60571e3 into main Jun 11, 2026
5 checks passed
@todti todti deleted the fix/html-markdown-attachment-preview branch June 11, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown render truncated

3 participants