Skip to content

Global Styles: Add alignment support in global typography styles #48202

Closed

Description

@danielbachhuber

Before we land #48146, we'd like to first support alignment in global typography styles. Alignment support can include justification, as long as it also supports hyphenation.

To properly handle hyphenation, we'll need lang support on the block level at least, too: #15349

Related #27300, #8450

Done is:

  • It's possible to set alignment in global styles.
  • Alignment is only applied to post content.
  • Justify is included in the alignment options.
  • Hyphenation is also available as a global style.

Activity

  1. added
    Global Styles
    on Feb 17, 2023
  2. sejas commented on Feb 17, 2023

    @sejas
    Contributor

    I can start investigating this issue next week 👌

  3. added
    [Type] Enhancement
    [Feature] Typography
    on Feb 20, 2023
  4. jasmussen commented on Feb 23, 2023

    @jasmussen
    Contributor

    A couple of notes on justified text:

    • It is required in some news rooms and schools, and therefore necessary to support
    • It is in most cases harder to read than aligned text, providing an opportunity to show a legibility warning in context
    • Justified text in almost all cases is a global set it and forget it setting, unlike center/right aligned text, and therefore makes great sense in global styles. It makes less sense on a per-block basis, as we generally wouldn't want anyone who needs to use justified text to select all and choose "justified" across every post on a site.

    In that light, here's a way way obsolete mockup of justified text in a global interface:

    oldler-justified-mockup

    The icons, colors, all of the above are off, so do not take this as a design. Purely as an example of one way this interface might be put together.

  5. strarsis commented on Feb 28, 2023

    @strarsis
    Contributor

    Would this be also a good place for adding controls for text-align-last?

  6. jasmussen commented on Mar 1, 2023

    @jasmussen
    Contributor

    Potentially. I haven't used that one very much.

  7. Thelmachido commented on Jun 2, 2023

    @Thelmachido

    Hi folks, thank you for working on this. Just making a note that this was requested in forums here: https://wordpress.org/support/topic/space-between-header-and-body-on-pages-drives-me-crazy/#post-16789630

  8. added
    [Status] In Progress
    on Jul 7, 2023
  9. jasmussen commented on Mar 4, 2024

    @jasmussen
    Contributor

    Per recent conversation, here's a refreshed version of how this could look:

    Justified text
  10. removed their assignment
    on Apr 5, 2024
  11. sejas commented on Apr 5, 2024

    @sejas
    Contributor

    I unassigned me from this issue since we won't focus on this in the short time.

  12. t-hamano commented on Apr 20, 2024

    @t-hamano
    Contributor

    textAlign block support has been added in #59531. After that, we are first trying to add text alignment support at the block level.

    Related issues/PRs:

  13. richtabor commented on Apr 24, 2024

    @richtabor
    Member

    Why not put this within the Text and Headings views, rather than add another to this top-level typography? It could be hierarchal as well.

    CleanShot 2024-04-24 at 17 51 35

  14. jasmussen commented on Apr 25, 2024

    @jasmussen
    Contributor

    Seems fine to do that. Figma if you want to tinker.

  15. richtabor commented on Apr 25, 2024

    @richtabor
    Member

    I added an alternate to the Figma. What do you think?

    Justified text alternate

    Based on #59531.

  16. jasmussen commented on Apr 25, 2024

    @jasmussen
    Contributor

    Looks good! Whether it's the row of 4 icons or a vertical stack with labels, I've less of a strong opinion on, happy to defer.

    What I'd deem important is to show the yellow notice below the justified text option when selected, I'm assuming that's still present?

  17. richtabor commented on Apr 25, 2024

    @richtabor
    Member

    What I'd deem important is to show the yellow notice below the justified text option when selected, I'm assuming that's still present?

    Sure, I had missed that.

  18. t-hamano commented on Apr 26, 2024

    @t-hamano
    Contributor

    If all four of left, center, right, and justify are allowed, I think we can use the TextAlignmentControl component added in #60841 as is.

    However, the original design only allows two types at the root level: left and justfiy.

    Which options should be allowed?

  19. jasmussen commented on Apr 26, 2024

    @jasmussen
    Contributor

    Good point to clarify. I omitted center from the original designs because it seems borderline useless as a default layout for text, arguably even less legible than justified text. Though I suppose if it substantially eases implementation, and if the center option would carry a similar legibility warning as justified does, perhaps it might be fine, so as to unstick this?

  20. richtabor commented on Apr 30, 2024

    @richtabor
    Member

    I say we include them all, even without legibility notices. Sure, it may not be ideal, but I can see it working in some cases. And I'm hesitant to have some controls available in some places, while not in others.

  21. t-hamano commented on May 1, 2024

    @t-hamano
    Contributor

    Thanks for the feedback!

    As suggested in #60762, I am thinking of adding the text alignment UI at the block level first. If it ships successfully, I would like to come back to this issue.

  22. jasmussen commented on May 1, 2024

    @jasmussen
    Contributor

    I say we include them all, even without legibility notices. Sure, it may not be ideal, but I can see it working in some cases.

    I would not omit the legibility notice, at least from the justified text one. It's a very common question why WordPress doesn't support justified text in the text alignment dropdown, and showing the legibility notice in context of the global control would provide the answer right there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Global Styles[Feature] Typography[Status] In Progress[Type] Enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions