Footnotes: Fix writingMode (text orientation setting) on the front#54345
Footnotes: Fix writingMode (text orientation setting) on the front#54345carolinan wants to merge 3 commits into
Conversation
t-hamano
left a comment
There was a problem hiding this comment.
My understanding is that, like other block supports, writing-mode style should also output inline styles automatically via the get_block_wrapper_attributes() function. Therefore, this code in the Post Navigation Link block should not be necessary in the first place.
After investigating the problem, I found that the fundamental problem was that the writing-mode was removed by the safecss_filter_attr() function in the style engine's filter_declaration method.
The safecss_filter_attr() function currently does not allow the writing-mode property.
Therefore, the ideal approach I believe would be the following:
- Create a
lib/compat/wordpress-6.4/kses.phpfile and add a hook to allow thewriting-modeproperty on the Gutenberg plugin side (For backward compatibility with WordPress versions supported by the Gutenberg plugin). Like this. However, the writing-mode support should have been added in WP6.3, so thewordpress-6.3directory might be more appropriate. - Confirm that the problem has been resolved in the Footnotes block.
- Remove this code in the Post Navigation Link block and verify that the problem does not occur.
- In the core, submit a patch to allow
safe_css_filter_attr()function to allow thewriting-modeproperty (and add unit tests).
@ramonjd @tellthemachines
I know you are all very familiar with this kind of work, so if you have any problems with these steps, please comment 🙇
|
Thank you for checking, @ramonjd! @carolinan I would be happy to help you with these steps if needed 👍 |
|
@t-hamano Thank you. I was not happy with needing to add it this way to the PHP files, but could not figure it out. You solved it! |
I have submitted #54581 which achieves these three things, so I would like to close this PR. |
What?
Closes #54344
Adds the missing inline styles for the writing mode (text orientation typography setting) on the front.
Why?
The setting works in the editor but not the front.
How?
Checks if the attribute for the writingMode block support is set and adds the inline styles to the block wrapper.
Testing Instructions
Activate a block theme.
The writing mode setting is disabled by default; set it to true in theme.json settings > typography > writingMode:
Create a new post or page, and add a footnote.
Select the footnote and enable the vertical text orientation option in the typography panel.
Save and view the front.
Confirm that the text is now vertical on the front.
Screenshots or screencast
In the video, I am setting the text orientation setting to vertical:
https://github.com/WordPress/gutenberg/assets/7422055/e8a514bf-bf4a-44af-bcd1-6ebfb4502779