Skip to content

Social Links colors not working for roles without unfiltered_html capabilities #29297

@oandregal

Description

@oandregal

In #28084 we added new color controls to style the icons and their background. The way this works is by using CSS Custom Properties attached to the block (post_content) such as the block style attribute looks like:

style="--wp--social-links--icon-color:#FFFFFF"

This is problematic for kses which maintains a list of allowed property names and --wp--social-links--icon-color is not one of them (see list). As a result, the color controls won't work for roles that don't have unfiltered_html capabilities.

Steps to reproduce:

  • Use a WordPress 5.7 environment (latest from wordpress-develop trunk or using the beta-tester plugin) without the Gutenberg plugin.
  • Log in as an author role (or any other role without unfiltered_html capabilities).
  • Go to the post editor and add a social links block.
  • Select white as the icon color and orange as the background color.
  • Publish and go to the front-end => note that the colors are not present. Inspect the DOM and see that the CSS variables used to set the colors are not attached to the DOM.
  • Reload the editor => the block is invalidated.

Metadata

Metadata

Labels

[Block] SocialAffects the Social Block - used to display Social Media accounts[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions