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

Gutenberg: Spacer block (attribute pruning) #27645

Closed
gwwar opened this issue Oct 5, 2018 · 5 comments
Closed

Gutenberg: Spacer block (attribute pruning) #27645

gwwar opened this issue Oct 5, 2018 · 5 comments
Assignees
Labels
[Goal] Gutenberg Working towards full integration with Gutenberg [Type] Task

Comments

@gwwar
Copy link
Contributor

gwwar commented Oct 5, 2018

See #27294

As the most used block ;) let's make sure that we can insert this and it's serialized appropriately in post content

Status

Awaiting fix in core
Awaiting fix in D19247-code

@gwwar gwwar added [Goal] Gutenberg Working towards full integration with Gutenberg [Type] Task labels Oct 5, 2018
@dmsnell
Copy link
Member

dmsnell commented Oct 5, 2018

Tested in current wpcalypso environment and it seemed to work as expected. I addd, resized, deleted, and reloaded a page with the spacers.

spacer-in-calypso mov

@dmsnell
Copy link
Member

dmsnell commented Oct 5, 2018

After reloading the page I discovered the problem - it appears as though Gutenberg is pruning attributes from the block on save.

Invalid reloaded block
Note the missing aria attribute

<!-- wp:spacer {"height":242} -->
<div style="height:242px;" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

Valid new block

<!-- wp:spacer {"height":63} -->
<div style="height:63px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

Tested in a separate Gutenberg/WordPress environment and the save/load loop was fine without breaking. I tested with Gutenberg from master@{two weeks ago} as well and it was still fine so this appears to be happening on the dotcom side.


Confirmed that the database has the malformed content. Looking for some filter on save.

@mcsf
Copy link
Member

mcsf commented Oct 9, 2018

This is likely very similar to core's issue of filtering a saving post's HTML when a user isn't admin (unfiltered_html capability). See:

The main reasons for some input to be filtered:

  • Using aria-* attributes.
  • Using data-* attributes.
  • Using certain inline styles, notably url(), based on this mask.

The proper fix is to be done in core WP (kses). A core ticket for CSS's url() has been opened, but further work in kses is needed in order to whitelist aria- and data- wildcards.

@vindl vindl added this to the Core Blocks Integration milestone Oct 9, 2018
@dmsnell dmsnell self-assigned this Oct 9, 2018
@vindl
Copy link
Member

vindl commented Oct 10, 2018

@dmsnell just a note that I'm seeing a similar issue with Audio block after uploading and saving (tested with business plan because audio uploads aren't included in free).

@vindl vindl changed the title Gutenberg: Spacer block Gutenberg: Spacer block (attribute pruning) Oct 10, 2018
@dmsnell
Copy link
Member

dmsnell commented Oct 15, 2018

after the merge of D19247-code the spacer block is working

@dmsnell dmsnell closed this as completed Oct 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Goal] Gutenberg Working towards full integration with Gutenberg [Type] Task
Projects
None yet
Development

No branches or pull requests

4 participants