-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Style Engine: Add support for text columns (column-count) #46566
Conversation
Referring to the column count CSS support as text column was a deliberate decision during earlier iterations of the block support.
Size Change: +908 B (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one, glad to see text columns picked up again!
In terms of the introduction to the style engine and support for outputting this rule, this all looks good to me:
✅ Looks like it's added to the right places
✅ Tests pass
✅ The logic of calling it a different name in the data structure sounds good to me (textColumns
) since it would be easy for column-count
to be confused
In playing around with the setting in the linked PR, I noticed a peculiarity with how column count works with paragraphs. From a bit of Stack Overflow searching, it sounds like browsers might be adding some default -webkit-margin-before
spacing or something of the like? The result is that there's a bit of spacing at the beginning of the first column that isn't present on the subsequent columns. It looks like adding a rule allows this to be removed. So, maybe not for this PR, but I wonder if when the rules are output, if it needs a preset (or preset-like) has-text-columns
class added that resets things as they need to be?
Before adding a reset rule | After adding a reset rule |
---|---|
In terms of the style engine change, though, this looks good to me, so I've given it the ✅. Might be worth getting a second opinion from @ramonjd too, since I'll be AFK shortly.
LGTM Thanks for updating the tests! |
Thanks for the speedy reviews @andrewserong and @ramonjd 🚀
How this manifests itself, might be a little different based on where the column count style is applied. After you flagged the issue, I noticed that if I applied the I'll merge this PR as is, and we discuss things further in a follow-up |
Oh, good find! Yes, totally stuff to look into / explore separately 🙂 |
Related:
What?
Adds
column-count
aka "text columns" to the style engine.Why?
The addition of
column-count
("text-columns") to the style engine provides the base to add it as a block support as per #33587. Further history can be found via that PR and the following issues:How?
Testing Instructions
npm run test:unit -- --testPathPattern packages/style-engine/src/test/index.js
npm run test:unit:php -- --filter WP_Style_Engine_Test