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

Paragraph: Add CSS columns #27118

Open
scruffian opened this issue Nov 19, 2020 · 7 comments
Open

Paragraph: Add CSS columns #27118

scruffian opened this issue Nov 19, 2020 · 7 comments
Labels
[Block] Paragraph Affects the Paragraph Block [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Feature New feature to highlight in changelogs.

Comments

@scruffian
Copy link
Contributor

It would help readability of paragraphs on wide screens if the text were to go to more than one column. This can be achieve using the css columns property. It would look like this:

Screenshot 2020-11-19 at 18 01 05

I think this could be enabled/disabled with a toggle. On wider screens the number of columns would increase, and on mobile we wouldn't have any.

@scruffian scruffian added [Block] Paragraph Affects the Paragraph Block [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Feature] Full Site Editing labels Nov 19, 2020
@aristath
Copy link
Member

This can already be accomplished in themes using block-styles.
The block-style adds the class, and then the theme can simply style that. I don't think we need separate controls etc on the paragraph block, this is something that will need to be considered on the theme level

@scruffian
Copy link
Contributor Author

This feels like something that lots of themes might want to implement, so I'd rather not move it to the theme as we'll need to write the same implementation in many themes. I also think it's something that users will want to customize which is why I'd rather see it as an option in the block.

@ntsekouras
Copy link
Contributor

Related: #25459

@kjellr
Copy link
Contributor

kjellr commented Dec 2, 2020

This can already be accomplished in themes using block-styles.

That's true, but I could see the benefit to having additional controls beyond that: a way to adjust the number of columns, and a checkbox for whether or not the columns should disappear on mobile. Those options aren't really suited well to a block style.

@aristath
Copy link
Member

aristath commented Dec 3, 2020

Did we not use to have a text-columns block? AFAIR it was later abstracted and converted to the more generic columns block.
I understand there's a difference between using the CSS columns property and actually having 2 columns, but usability-wise I don't think it will make much of a difference. If the users wants 2 columns, they just add 2 columns... There's no need for a columns control in paragraphs when we already have that functionality in the columns block.
However, if the user wants auto-scaling columns, then things change. I can definitely imagine a newspaper-like or heavy text-based article benefiting from that... But in that case it wouldn't define the number of columns, they can already do that by adding columns and splitting their text in separate columns. They could however define the column-width. So something like this would work beautifully in this case:

p.is-style-columns {
  column-gap: 2em;
  column-width: 15em;
  column-rule: 1px solid rgba(0,0,0,.1);
}

It's responsive, works for all content and viewports and it's pretty simple to implement.
So then the question becomes do we want to allow customizing the column-width? If yes, then we add a control for the width. If not, then this can be a block-style. And if a block-style, then 15em is a pretty reasonable middle-ground for the columns-width 😉

@scruffian
Copy link
Contributor Author

Can we apply a block style to all blocks using theme.json?

@aristath
Copy link
Member

aristath commented Dec 3, 2020

I don't think so... but having a defaultStyle prop in theme.json would be pretty amazing. Perhaps we should create a new issue for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Paragraph Affects the Paragraph Block [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Feature New feature to highlight in changelogs.
Projects
None yet
Development

No branches or pull requests

5 participants