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

Writing modes: explore alternative character and block direction support #38038

Open
2 tasks
ramonjd opened this issue Jan 18, 2022 · 0 comments
Open
2 tasks
Assignees
Labels
Internationalization (i18n) Issues or PRs related to internationalization efforts [Type] Enhancement A suggestion for improvement.

Comments

@ramonjd
Copy link
Member

ramonjd commented Jan 18, 2022

This issue is mainly to capture and centralize discussions from the following issues and PRs in relation to vertical writing modes:

It's a work in progress and might not be accurate. I'll correct mistakes and assumption as the discussion evolves. Thank you!

What problem does this address?

Most text (characters and sentences and so on) on the web flows horizontally, from left to right. Blocks of text flow vertically, from top-to-bottom. This is true for Latin-based alphabets and some non Latin-based alphabets (Cyrillic, Thai and Greek for example).

As far as CSS is concerned, this is default.

direction: ltr;
writing-mode: horizontal-tb;

Arabic characters flow from right to left, but still follow a vertical block flow.

direction: rtl;
writing-mode: horizontal-tb;

Some written languages display characters vertically, with blocks (paragraphs, headings and so on) flowing horizontally from right to left (Japanese, Korean, Chinese et. al.,) or left to right (Mongolian).

writing-mode: vertical-rl; // or vertical-lr 

Commonly you'll see Han scripts following the left-to-right, top-to-bottom paradigm:

Screen Shot 2022-01-18 at 3 46 34 pm

Sometimes there's a mix:

Screen Shot 2022-01-18 at 3 46 34 pm

There are two perspectives:

1. Visual design, where there is no i18n imperative

Screen Shot 2022-01-18 at 5 22 37 pm

2. Language-specific writing modes

Screen Shot 2022-01-18 at 5 24 01 pm

This issue aims to answer the question: Should we provide a way to configure text direction and orientation in the block editor (and if so, how?)

What is your proposed solution?

To see if there's a way to offer support for writing modes in the editor, whether at a (text) block or container level.

Both come with a bit of baggage in relation to layout and flow.

From a purely visual perspective it's possible to apply writing-mode: vertical-rl; to individual text blocks such as paragraphs or list items. This will ensure the character flow is vertical.

Consecutive paragraph blocks however won't honour the correct block flow, that is, from right to left.

This code pen has a few examples: https://codepen.io/BoganJustice/pen/rNGbNPM

To ensure a collection of text items have the same block flow, it might be necessary to add writing-mode: vertical-rl; to their container. The container might be a Group Block for instance.

Here is a template I've been working on in the Site Editor to illustrate the various effects:

Screen Shot 2022-01-18 at 2 26 07 pm

A side effect is that changing the writing mode to vertical and the block flow to horizontal will effect some layout-related styles, regardless of whether it's container- or block-based.

An example is margin-top, which will apply to the top of an element regardless of its orientation. CSS logical properties will help us here in some way, but it might involve redefining/overwriting the underlying layout styles to cater for changes in writing mode. Using margin-block-end in place of margin-bottom for paragraphs within a container for example.

TODO

  • experiment with some patterns in the block editor, comparing block- and container- level support for writing mode
  • see if layout might benefit from CSS logical properties to allow frictionless switching of writing modes

References

https://24ways.org/2016/css-writing-modes/
https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties

@ramonjd ramonjd added [Type] Enhancement A suggestion for improvement. Internationalization (i18n) Issues or PRs related to internationalization efforts labels Jan 18, 2022
@ramonjd ramonjd self-assigned this Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internationalization (i18n) Issues or PRs related to internationalization efforts [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

1 participant