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

Add typography block style variations #330

Closed
wants to merge 9 commits into from

Conversation

carolinan
Copy link
Contributor

@carolinan carolinan commented Sep 16, 2024

Description
This is an experiment for #305

This does not replace the custom font sizes in theme.json, it is a complement that helps us remove hard coded font sizes in the markup.
This means that the size and line height can be adjusted in a global style variation, if we want.

What was changed:

  • A new block style variation for the paragraph block was added, with font size XL and line height 1.2. The font style was then applied to a section of a block pattern, replacing the size and line height in the markup.
  • A new block style variation for the paragraph, heading and post-terms block was added, with font size small, uppercase, font-weight 700, and letter-spacing 1.4px.

Screenshots
This screenshot shows the "Lead" paragraph style variation, text with the old markup first, and the new variation second: There should be no visible difference:
p-xl

This video shows how the style is applied:
https://github.com/user-attachments/assets/af5eb091-3efa-412c-9c91-b8b5b1cbc8be

Testing Instructions

Place a paragraph, a post terms block and two heading blocks: One of the headings should use the H6 level.
Apply the different style variations, and compare the result in the editor and front.
The uppercase variation should match the style of the H6.

@carolinan carolinan marked this pull request as ready for review September 16, 2024 11:43
Copy link

github-actions bot commented Sep 16, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: carolinan <[email protected]>
Co-authored-by: juanfra <[email protected]>
Co-authored-by: beafialho <[email protected]>
Co-authored-by: jasmussen <[email protected]>
Co-authored-by: richtabor <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@beafialho
Copy link
Contributor

This looks good to me!

@carolinan
Copy link
Contributor Author

carolinan commented Sep 17, 2024

It's more a matter of if this is really something that we want to do. Is having two font size controls the best experience for the user.

Copy link
Member

@juanfra juanfra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I am not sure about adding this one. I believe it could be confusing for users having two places competing for the same functionality, so close to each other and with the same name (XL). I believe, for many users, the difference between both of these won't be clear.

Are we going to be adding more of these?

@beafialho
Copy link
Contributor

I like that we're providing another styling option, but it can seem a bit incoherent to see two XL in two different places.

@carolinan
Copy link
Contributor Author

If a style variation adds more than just a size, for example size, letter-spacing, transformation, weight and line height combinations; then they are more helpful because they are like shortcuts, much like the "pill" or "rounded" styles.
If the user wants to adjust all of these typography settings on a block, it would take many clicks, with a variation it's just one click.

But Rich only pointed out this one combination, which is used in two patterns: this and one other.

What kind of names could this type of variation use?
"Ingress", "lead", "Intro", "Subheading" (for headings) comes to mind.
"Large lead" "Uppercase subheading" ?

@carolinan
Copy link
Contributor Author

Lede? Callout? Byline? Kicker? -Yes I asked Chat GPT for examples from the news world.

@carolinan
Copy link
Contributor Author

BTW these section style names still needs to be updated "Style 1" 😄

@beafialho
Copy link
Contributor

If a style variation adds more than just a size, for example size, letter-spacing, transformation, weight and line height combinations; then they are more helpful because they are like shortcuts

Yes that's the best term, I like that we'd be providing shortcuts 👍

I find "Intro" or "Large Lead" more intuitive than the others.

@carolinan
Copy link
Contributor Author

This example uses the XL font size so maybe "Large lead" then. It depends on if we are adding more...

@beafialho
Copy link
Contributor

Another style I can think of we could add is this one:

Captura de ecrã 2024-09-17, às 09 43 36

It has specific letter spacing and can work nicely in some occasions. It would be a nice shortcut to add.

It's used in some categories:
Captura de ecrã 2024-09-17, às 09 41 11
Captura de ecrã 2024-09-17, às 09 41 17

And H6:
Captura de ecrã 2024-09-17, às 09 41 28

Copy link

github-actions bot commented Sep 20, 2024

Preview changes

You can preview these changes by following the link below:

I will update this comment with the latest preview links as you push more changes to this PR.
⚠️ Note: The preview sites are created using WordPress Playground. You can add content, edit settings, and test the themes as you would on a real site, but please note that changes are not saved between sessions.

@carolinan carolinan changed the title Experiment: Font-size as block style variation Add typography block style variations Sep 21, 2024
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 3,
"slug": "uppercase",
"title": "Uppercase",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also tried "Bold Uppercase" but it did not fit inside the button in the interface, it got truncated.

@jasmussen
Copy link
Contributor

Thanks for the exploration. Here's a quick GIF of the interface:

paragraph variations

My main comment here would be the user experience of using these variations for paragraphs. I think the instinct behind #305 (CC: @richtabor) is a good one: making it easy for someone to easily apply visual styles across text-blocks so as to easily achieve a coherence across content.

The main problem with this is the variation interface itself. It has high prominence, being at the top of the inspector, which for a base atomic block such as the paragraph is pretty big. It's also not that valuable in most cases of authoring blog posts; all-caps and pill shaped notably are not going to make good reading experiences in those cases. Those styles are perfect for unique use cases such as subheadings or other section delimiters.

Pending any additional thoughts by Rich, I'd lean towards not adding these variations, at the very least not to the Paragraph block, since improvements to the variation UI are not immediately on the radar for the block editor. Would it be possible instead to have a category of utility patterns? Subheadings, things like that, which come with these all-caps and pill shape styles by default?

"Lead" is also very close to the XL default font size, even if it has a tighter line-height. I don't know that's sufficent to add this.

@carolinan
Copy link
Contributor Author

The problem with adding them as patterns is that all the styling is in the markup, so they can not be changed in the global style variations and section styles.

@jasmussen
Copy link
Contributor

Yep, that would be the trade-off, and not ideal. I think we should work to improve this, through type styles or otherwise, in the block editor itself. That's a longer term view.

@carolinan carolinan mentioned this pull request Sep 24, 2024
@carolinan
Copy link
Contributor Author

Can we review the use of paragraphs with the pill style and uppercase again, and use the headings -with the correct heading levels as suggested and disregarded in past pull requests.

Using all uppercase for large sections of text reduces readability*, having these options for the paragraph may encourage unintended use.

https://accessibility.huit.harvard.edu/design-readability
https://uit.stanford.edu/accessibility/concepts/typography#allCaps

@jasmussen
Copy link
Contributor

Using all uppercase for large sections of text reduces readability*, having these options for the paragraph may encourage unintended use.

Just to clarify, that's specifically one of the reasons why I'd suggest not making these into block variations. But that doesn't mean it's not useful as patterns, whether small utility patterns on their own, or as part of larger patterns, where these styles are used well.

@carolinan
Copy link
Contributor Author

After removing the paragraph styles, the theme is still left with the uppercase block style for the heading and post terms, is there value in keeping them? I did not finish implementing it since we were still discussing it, there are more places where using the CSS class could help remove the hard coded style from the markup.

@richtabor
Copy link
Member

I don't think we should have one-off text styles applicable to some content/text blocks, but not others. It creates an inconsistent experience. And it's not really solving the typography situation we have today, where some styles are hardcoded into paragraphs and headings (already).

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.

5 participants