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

Support ragged tables and show full table borders #2511

Merged
merged 1 commit into from Mar 30, 2018
Merged

Conversation

alexcjohnson
Copy link
Contributor

Fixes #2133 - allows ragged columns for both headers and cells, and even a mix of 1D and 2D - see the table_ragged mock

Fixes #2401 - how some sides of the table were often missing their border - I extended the clippath around each column to include space for the cell borders. This has some strange effects right now if you use different border widths per cell, see eg cell 5 in table_ragged:
screen shot 2018-03-30 at 9 36 36 am
On master this still isn't what I'd call "right", but its quirks are at least a little subtler:
screen shot 2018-03-30 at 10 07 58 am
Semi-opaque borders (on this branch) do even weirder things:
screen shot 2018-03-30 at 9 40 36 am
That said semi-opaque borders already behave oddly on master:
screen shot 2018-03-30 at 9 42 28 am

I'm not sure it's worth doing any better right now, but some thoughts for future reference:

  • In order to fully display the borders where they overlap, we'd need to display all borders above all cell backgrounds - ie a separate border layer, with its own infinite scrollers etc... seems like more trouble (and overhead) than this edge case really warrants.
  • It's still ambiguous what order to draw the borders in - perhaps we want wider borders to override thinner ones, so we order them by thickness? That takes care of one common use case, using a thicker border to highlight a cell. But it doesn't cover using a different color to highlight a cell - actually I didn't explore array line colors at all when making this PR.
  • Another possibility I considered - both to fix Table borders sometimes get cut off #2401 and to clear up ambiguities - is to move the border to fully inside each cell. Then none of the borders would overlap, so the semi-transparent issue goes away, there's no ordering, and no clippath extension needed. But it messes up the most common case, of a consistent border everywhere, by doubling the effective width of interior lines vs peripheral lines.
  • Anyway to really do borders right we need a different API that respects the fact that there's one line per junction between cells, not one line per cell. I'm not sure what that would look like, but it would for example allow horizontal-only or vertical-only lines, or outlining a group of cells, neither of which we can do currently. Though THIS gets ambiguous with column reordering...
  • I almost want to remove per-cell lines entirely, and only support per-cell fill colors, which don't have ANY of these issues. We could then still add support for horizontal-only or vertical-only lines, and could support semiopaque borders without any of this weird overdrawing by only expanding the clippath along the outer edges.

cc @etpinard - if you think it's worthwhile I can move the discussion ^^ into a separate issue and gather input from table users like Dash and editor folks...

@etpinard
Copy link
Contributor

I almost want to remove per-cell lines entirely, and only support per-cell fill colors, which don't have ANY of these issues. We could then still add support for horizontal-only or vertical-only lines, and could support semiopaque borders without any of this weird overdrawing by only expanding the clippath along the outer edges.

This solution sounds the best to me. As this would be a breaking change, let's keep track of in #420 .

@etpinard
Copy link
Contributor

... but yes input from users would be nice.

@etpinard
Copy link
Contributor

Nice fixes! 💃

@alexcjohnson alexcjohnson merged commit da37b4f into master Mar 30, 2018
@alexcjohnson alexcjohnson deleted the ragged-table branch March 30, 2018 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Table borders sometimes get cut off autofill header title
2 participants