Skip to content

Table copy/download actions silently fail in fullscreen mode (closest('[data-streamdown="table-wrapper"]') breaks across the portal) #567

Description

@ndozhh

Summary

In a table's fullscreen view, the copy and download buttons do nothing. The same buttons work correctly on the inline table.

Root cause

TableCopyDropdown, TableDownloadDropdown and TableDownloadButton locate the table with:

el.closest('[data-streamdown="table-wrapper"]')?.querySelector('table')

The fullscreen overlay is rendered with createPortal(..., document.body) and its container is marked data-streamdown="table-fullscreen" (not table-wrapper). Because a portal detaches DOM ancestry, from inside the fullscreen overlay el.closest('[data-streamdown="table-wrapper"]') returns null, so every action hits the "Table not found" branch and silently no-ops.

This affects all three .closest('[data-streamdown="table-wrapper"]') call sites (copy dropdown, download dropdown, download button).

Version

  • streamdown@2.5.0 (latest).
  • Present since 2.4.0, when fullscreen tables were added (Full Screen Mode for tables #389). The 2.4.0 changelog states "Copy and download controls remain available in the fullscreen view", but they are non-functional.

Reproduction

  1. Render <Streamdown> with a markdown table and table controls enabled (copy/download/fullscreen).
  2. Click the expand/fullscreen button on the table.
  3. In the fullscreen overlay, click Copy (any format) or Download → nothing is copied/downloaded (the onError path reports "Table not found").
  4. Close fullscreen and use the same buttons on the inline table → they work.

Suggested fix

Broaden the lookup to also match the fullscreen container:

el.closest('[data-streamdown="table-wrapper"],[data-streamdown="table-fullscreen"]')?.querySelector('table')

Alternatively, pass the table element/ref into the fullscreen overlay instead of relying on DOM ancestry (which the portal breaks).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions