fix(table): add table-wrapper to fullscreen portal so copy/download work#470
Open
sleitor wants to merge 1 commit intovercel:mainfrom
Open
fix(table): add table-wrapper to fullscreen portal so copy/download work#470sleitor wants to merge 1 commit intovercel:mainfrom
sleitor wants to merge 1 commit intovercel:mainfrom
Conversation
TableCopyDropdown and TableDownloadDropdown both use
dropdownRef.current?.closest('[data-streamdown="table-wrapper"]')
to locate the table element. When rendered inside a React portal
(document.body), the DOM ancestry is severed, so closest() returns null
and the copy/download actions silently do nothing.
Fix: add data-streamdown="table-wrapper" to the inner presentation div
inside the fullscreen portal so the closest() traversal can succeed.
Closes vercel#468
Contributor
|
@sleitor is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes copy and download buttons being unresponsive when a table is in fullscreen mode.
Root Cause
TableCopyDropdownandTableDownloadDropdownboth use:to locate the
<table>element. When the fullscreen overlay is rendered viacreatePortal(appended todocument.body), the DOM ancestry is severed — none of the portal's ancestors havedata-streamdown="table-wrapper", soclosest()returnsnulland the copy/download actions silently fail.Fix
Add
data-streamdown="table-wrapper"to the innerrole="presentation"div inside the fullscreen portal. This restores the ancestor chain that the dropdowns rely on to find the table.Testing
Added a test to
table-fullscreen.test.tsxverifying that[data-streamdown="table-wrapper"]and[data-streamdown="table"]are accessible inside the fullscreen overlay. All 983 tests pass.Closes #468