Improve document context handling in ColumnSizing feature #5753
Unanswered
parassantra
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
TanStack Table version
v8.20.5
Framework/Library version
v18.2.0
Describe the bug and the steps to reproduce it
Description
The current implementation of the
getResizeHandler
function in theColumnSizing
feature doesn't properly handle the document context in all scenarios, particularly in environments where the globaldocument
object might not be available or when dealing with new windows and React.createPortal.Proposed Change
typescript:packages/table-core/src/features/ColumnSizing.ts
const contextDocument =
contextDocument ||
(typeof document !== 'undefined'
? (((e as MouseEvent | TouchEvent).target as Element)?.ownerDocument ?? document)
: null)
Expected Behaviour
document
object is not available.Current Behaviour
The current implementation may not work correctly in all scenarios, particularly when dealing with windows/iframes or in environments where the global
document
object is not available.Steps to Reproduce
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://codesandbox.io/p/sandbox/github/parassantra/react-table-issue
Screenshots or Videos (Optional)
Screen.Recording.2024-09-15.at.21.40.25.mov
Do you intend to try to help solve this bug with your own PR?
Yes, I am also opening a PR that solves the problem along side this issue
Terms & Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions