New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix offset() for elements within foreign object context #10483
Conversation
It seems that your unit test environment does not allow the The DOM elements seem to have |
Hi @kumilingus I think that at this point, the PR is ready for a review. Thank you for sharing. |
The |
Hi @budnix, I moved the test to the |
I reviewed the code, and besides one mistake, it looks good 👌 PS: You can run these tests by running |
Co-authored-by: Krzysztof Budnik <571316+budnix@users.noreply.github.com>
Hi @kumilingus I have great news! Your merged pull request was just published with Handsontable v14.0.0 Thank you again for your input. Here's #9754 the full list of changes for this release. |
Context
After inserting the table into SVG , the cell selection boxes will stop appearing. The user can edit the cell, but the input element is hidden (or misplaced).
Selecting the
B3
cell:Editing the
B3
cell:I managed to locate the root cause of the problem. It lies within the DOM utility
offset
that does not account for the DOM element to be inside a foreign object. The foreign object has neitheroffsetLeft
noroffsetTop
properties defined and theoffset()
method ends up returning{ top: NaN, left: NaN }
.An example use case is the possibility to insert tables into an SVG document and connect columns or rows using links.
https://jsfiddle.net/kumilingus/j4s8bf97/
How has this been tested?
Types of changes
Related issue(s):
Affected project(s):
handsontable
Checklist: