gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Table Block: Default Styling

Open anna-harrison opened this issue 9 years ago • 40 comments

The Table Block #850 currently gets inserted with a very simple 2x2 configuration with a thin black border applied to all cells:

screen shot 2017-08-31 at 2 50 42 pm

This issue looks at what the default styling of the table block should be

  • Number of rows, columns
  • Header row, or column
  • Borders
  • Shading

anna-harrison avatar Aug 31 '17 04:08 anna-harrison

Agreed this could be improved. What are your thoughts?

mtias avatar Aug 31 '17 10:08 mtias

Subtle alternate rows colors, to start with. Borders not so strong in color.

StaggerLeee avatar Aug 31 '17 17:08 StaggerLeee

I would suggest using deliberately smaller font size inside tables. (Difference in Gutenberg content width and front-end content width can be up to 500px. Regardless looks more nice with smaller font-size inside tables) People making tables know what they are inserting. On front-end tables can be with bigger font size, of course. Do not know if mixing font-sizes goes against core nature.

StaggerLeee avatar Aug 31 '17 19:08 StaggerLeee

It would be great if one could pull the table styling from the theme (if it has one). Is that possible w/ Gutenberg?

ammist avatar Sep 01 '17 00:09 ammist

@ammist yes, that's possible. It's how I put together the videos on this post.

mtias avatar Sep 01 '17 17:09 mtias

I think it would be good practice the default table template to include at least thead with th cells at the top. This will help the users to create more accessible content.

Shouldn't borders, colours, fonts, etc. come from the theme? The way the block sets it's styles through a class overwrites the default table styles from the theme, so setting these properties there will be in conflict with the theme.

gonzomir avatar Sep 04 '17 09:09 gonzomir

The way the block sets it's styles through a class overwrites the default table styles from the theme, so setting these properties there will be in conflict with the theme.

The expectation is that themes would provide styles targeting block classes. That way we can provide defaults and let theme overwrite or disable.

mtias avatar Sep 04 '17 12:09 mtias

The expectation is that themes would provide styles targeting block classes. That way we can provide defaults and let theme overwrite or disable.

Yes, but themes already provide styles for tables, my concern is not to overwrite them and force theme authors to overwrite again.

gonzomir avatar Sep 04 '17 13:09 gonzomir

@annaephox do you have any mockups you'd like to share based on your suggestions?

karmatosed avatar Sep 04 '17 18:09 karmatosed

I agree with the lighter color for the border. But I would not make the fonts smaller, because smaller fonts are harder to read and it is also not consistent.

Also I found the process to add or delete a new raw or column not super smooth. What about adding some Edit options to the sidebar?

Maybe there could be a setting-area for the table in general (like border-color, ...) and an setting-area for the specific raw or column wich is active. There you could set things like thead.

00travelgirl00 avatar Sep 11 '17 21:09 00travelgirl00

Yes, but themes already provide styles for tables, my concern is not to overwrite them and force theme authors to overwrite again.

Exactly. Where ever possible there is no need to output any styles in the front-end. <table> block is one of them.

Only problem is the editor (Gutenberg) styles. They would not match the styles in the front-end. The same issue is in other blocks where theme already have styles and Gutenberg styles overlap with them. <blockquote> is one of them.

samikeijonen avatar Oct 06 '17 11:10 samikeijonen

Wanted to drop a quick update. @annaephox, Brendan Woods, and myself have been working on some ideas for the Table Block. Wanted to drop a quick sketch that represents some of the ideas we've been going through.

tableblock_ideas
  1. When you add a new Table Block, you'll be presented with a blank state, asking you to input a few details about the block (rows and columns), or you can just submit and it defaults to x rows and x columns.
  2. You're presented with a table based on the options you've chosen

From here you can tweak and modify the layout/styles and content of the table between the TinyMCE edit buttons and the settings panel.

We have some ideas to improve on this and will be sharing soon!

jwold avatar Oct 16 '17 10:10 jwold

Thanks for the sketches. Some good starting points here and I would love to encourage even earlier sharing of things - my door is always open for iterating via messages along with issues. I really want to encourage you to use #core-editor or #design on .org Slack to have some design discussions also.

I do think things have got a little complicated in the sketch you are showing. Is there data evidence that this much is needed in the case of what we're doing? It feels like we've gone form a simple solution to something that maybe is too much. I totally get wanting to add a little more, but seems we've gone too far in the other direction.

Another caution is the insert having a layer, I am not sure that's intuitive to users and we are getting into a case where we have a very complicated, somewhat cluttered UI. How do other writing apps do this? What examples can you find in some research beyond Google?

I would like us to think more of what issue we're trying to solve and how we can do that in the simplest form. I am still not convinced we need 'everything'.

karmatosed avatar Oct 16 '17 16:10 karmatosed

@jwold : these are really neat ideas! Thanks for the sketches As a starting point, do you think we could assume that the table block is unchanged (from its current state), and figure out some aesthetically improved styling for how that table block looks when it is first inserted (in the absence of styling from themes)?

anna-harrison avatar Oct 17 '17 00:10 anna-harrison

Don't want to chime in too much here, just want to ask: can we use the CSS property currentColor to style the border color? If yes, then the border color will always be the same as the text color, which seems like a nice default rather than pure black.

jasmussen avatar Oct 17 '17 06:10 jasmussen

Good job on the sketches @jwold, nice to see some thoughts become pictures.

I think if we're looking for simple additions here, and I think the table block could use a few, perhaps these are the ones I might suggest:

  • Ability to create initial number of rows/columns.
  • More options on TinyMCE for text editing
  • Ability to edit cell colour
  • Border options

I'd imagine for the time being it's best to leave the side panel alone, but I think we could make some iterative changes without going too far.

brendan-woods avatar Oct 20 '17 04:10 brendan-woods

It is a way to much styling GUI options. Something usually themes do, and easy to call Gutenberg custom CSS file.

Of all this I personally would like to see first drag & drop table rows/columns solved.

StaggerLeee avatar Oct 20 '17 07:10 StaggerLeee

Thanks everyone for the great feedback! Want to touch on a few points.

  1. What I shared above represented some quick brainstorming of the potential of the block. I'm not married to any or all of the parts in the sketch. Just wanted to share a very initial work in progress, so glad to get feedback on that.
  2. Based on the above feedback I agree that we need to simplify the scope of what the table block does right now, so we we can ship something that's helpful.
  3. My thought right now is that we can suggest some basic improvements on this issue, then blue sky improvements can go in a separate issue.

jwold avatar Oct 20 '17 17:10 jwold

Current State

The current state of the table block looks like this:

screen shot 2017-10-20 at 10 44 50 am

It starts with 2 rows and 2 columns and you can add rows and columns from there. There are a few challenges with using the table block in it's current state:

If you try typing into one of the cells it automatically pushes the whole column over:

2017-10-20 10_13_37

If I switch to column 2 (can’t tab, have to click) it then pushes it back to center. But if my text gets longer it moves it past center. To fix this I have to drag the row or column back over. The problem with dragging is I can't see the movement of my dragging, I can only see what happens when I let go. In addition, the active target area for clicking on the dragging space is really small.

Tiny suggestions

Below are some suggestions to improve the table block.

  1. Don’t re-size columns when typing - Columns should stay equally distributed by default (perhaps we could add a checkbox in the settings panel to toggle this option). At least for me, when I go to create a table, I expect to be able to type stuff in and have the column stay to the size I set it until I choose to move it.

  2. Tabbing between cells Extremely important for keyboard use.

  3. Make resizing easier The clickable area to start dragging should be a bit bigger. Right now when I try to drag a row or a column I have to be RIGHT on the pixel to have the cursor change to a dragging option.

  4. Improve the insert/delete rows buttons

The current way it’s setup is a bit hard to read. I’d suggest we remove the icons for everything in the dropdown (but keep the icon in the menu) and re-arrange them. Or we could look at some ways to simplify the icons (the icons on Excel for iOS iPad might be something to consider)

insert

Another approach (inspired by an awesome sketch from @brendanwoods-xwp ) would be to play around with the table block toolbar (regardless of whether it's fixed or right above the block). The main goal being to try and give another way of adjusting columns and rows.

screen shot 2017-10-20 at 12 14 25 pm
  1. Add header rows and columns

For accessibility purposes this is important to be able to set what is the header row/column. Even if we don’t allow for any styling differences, this seems quite important to include. Experimented with a concept earlier on this: https://github.com/WordPress/gutenberg/issues/1470#issuecomment-311204988.

Beyond that I've added some additional suggestions to https://github.com/WordPress/gutenberg/issues/2609 with some more advanced features we could add in the future.

jwold avatar Oct 20 '17 19:10 jwold

Will put some more thoughts to it next week, but just wanted to note that I really appreciate your work here, @jwold, very nice.

jasmussen avatar Oct 21 '17 07:10 jasmussen