Closed cr0ybot closed 1 year ago
Actually after some re-testing, trying to figure out the parent with padding I realize we don't actually need the offset anymore, we just need to compare the table width with the parent, similar to what I originally had in the jQuery version. Here's the updated:
I think it is still possible for the table itself to be offset from its parent via margin or other means, so the offset from the parent may still be relevant, particularly if that margin is a fixed width.
@cr0ybot ah I see, you are right but I think just relying on offset left is still not sufficient as it doesn't consider the right side if it's overflowing or not. The fix ATM is more accurate if there are no inner offset from the table, but does overlook the scenarios that you mentioned. Let me think through this a bit more.
Replace
table.getBoundingClientRect().left
(viewport offset) withtable.offsetLeft
(parent offset) in table width calculation.Fixes #33