Skip to content
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

Table size calculation breaks when you let words wrap in a td #96

Open
timkpaine opened this issue Oct 23, 2020 · 2 comments
Open

Table size calculation breaks when you let words wrap in a td #96

timkpaine opened this issue Oct 23, 2020 · 2 comments
Labels
bug Concrete, reproducible bugs

Comments

@timkpaine
Copy link
Member

If you let a td be taller than regular-table expects, the scroll position miscalculates.

table.addStyleListener(() => {
  for (const td of table.querySelectorAll("td")) {
    td.style["white-space"] = "normal";
    td.style["word-wrap"] = "break-word";
  }
});
@timkpaine timkpaine added the bug Concrete, reproducible bugs label Jan 31, 2021
@telamonian
Copy link
Contributor

I've been getting bit by a similar bug lately while working with "fancy" th column headers that contain several children in a vertical layout.

So it seems like bug will trigger whenever the height of any table cell element (ie any th or td) is greater than the expected height. The default expected height appears to be 19px:

https://github.com/jpmorganchase/regular-table/blob/f23d782550a0fbfa2ec1c14fdf968683d98371b1/src/js/scroll_panel.js#L145-L158

@telamonian
Copy link
Contributor

telamonian commented Mar 30, 2021

@texodus Had asked me for a repro of this issue a while back. So here's a simple repro that shows how having a "fat" row in the column header breaks the calculation of number of rows to render:

https://bl.ocks.org/telamonian/a1475279ed2586c02f172fecf11ea681

Interestingly, it does render correctly on the very first draw() call (which in this example is invoked as part of window.init()). This suggests that the problem is fixable.

@texodus texodus linked a pull request Apr 19, 2021 that will close this issue
@texodus texodus removed a link to a pull request Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Concrete, reproducible bugs
Projects
None yet
Development

No branches or pull requests

2 participants