gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Table Block: alignment options are inconsistent and do not show up on the front end

Open designsimply opened this issue 8 years ago • 3 comments

Steps to reproduce:

  1. Create a new post and add a table block with some text in each cell.
  2. Click the "Align center" option in the toolbar to center all of the text.
  3. Publish the post and view it on the front end.
  4. Edit the post and choose the "Align right" option.
  5. Update the post and view it on the front end.

Result: centering makes the table appear full width and all text centered in the editor but neither is centered when the table is viewed on the front-end. Right aligning the table make the table move to the right but the text is not affected and neither the table nor the text is right-aligned on the front end.

h/t Radu Constantin for the report at https://make.wordpress.org/test/2018/09/05/call-for-testing-gutenberg-3-8-pre-release/#comment-1042

screen shot 2018-09-10 at 7 34 00 pm

screen shot 2018-09-10 at 7 49 04 pm

screen shot 2018-09-10 at 7 45 39 pm

screen shot 2018-09-10 at 7 48 03 pm

Seen at https://madefortesting.com/wp-admin/post.php?post=507&action=edit and https://madefortesting.com/2018/09/11/table/ running WordPress 4.9.8 and Gutenberg 3.8.0-rc.1 with the Twenty Seventeen theme active and using Firefox 62.0 on macOS 10.13.6.

designsimply avatar Sep 11 '18 01:09 designsimply

The "Align center" option adds a data-align="center" attribute to editor-block-list__block, which adds the rule

.editor-block-list__block[data-align="center"] {
    text-align: center;
}

Removing this rule will stop text from being centered in the table (which I think is the desired functionality because the rest of the alignment options don't align the text inside the table, not even on the front end). But this might break the alignment for other core blocks in the editor.

cristian-raiber avatar Sep 14 '18 13:09 cristian-raiber

@talldan do we have more actionable pieces here?

mtias avatar Oct 08 '18 12:10 mtias

@mtias - thanks for the ping. I'll pick this one up asap.

talldan avatar Oct 10 '18 03:10 talldan