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

Lots of extra markup in v2.6 #6089

Closed
rwrobe opened this issue Apr 9, 2018 · 10 comments
Closed

Lots of extra markup in v2.6 #6089

rwrobe opened this issue Apr 9, 2018 · 10 comments
Labels
[Feature] Blocks Overall functionality of blocks [Type] Bug An existing feature does not function as intended

Comments

@rwrobe
Copy link

rwrobe commented Apr 9, 2018

Issue Overview

The 2.6 release adds a lot of wrapping divs and internal divs to various components in a block.

Steps to reproduce

  • Add any core block (or custom block) to a post
  • Inspect and see the extra divs

Images

https://imgur.com/a/IkCWz

@aduth
Copy link
Member

aduth commented Apr 9, 2018

Can you elaborate on the problem that these divs are causing?

Aside: Looking briefly, most are from event normalization (e.g. focus outside detection). There's some hope that the need for element wrappers can be avoided in the future with enhancements to React's new Fragment:

key is the only attribute that can be passed to Fragment. In the future, we may add support for additional attributes, such as event handlers.

https://reactjs.org/docs/fragments.html#keyed-fragments

@aduth aduth added [Type] Question Questions about the design or development of the editor. [Status] Needs More Info Follow-up required in order to be actionable. labels Apr 9, 2018
@mtias
Copy link
Member

mtias commented Apr 9, 2018

Also, these are internal to the editor and not part of the content.

@rwrobe
Copy link
Author

rwrobe commented Apr 9, 2018

It's causing issues for styling more complex blocks. Specifically those with multiple elements that aren't laid out vertically-- e.g., a recent post with a thumbnail on the left and text content to the right.

@gziolo
Copy link
Member

gziolo commented Apr 10, 2018

https://imgur.com/a/IkCWz

/cc @brandonpayton. I think this is caused by the fact that we apply Autocomplete to all RichText components. It existed before, but was only the case for Paragraph block.

@danielbachhuber danielbachhuber added [Type] Bug An existing feature does not function as intended [Feature] Blocks Overall functionality of blocks and removed [Status] Needs More Info Follow-up required in order to be actionable. [Type] Question Questions about the design or development of the editor. labels Apr 10, 2018
@brandonpayton
Copy link
Member

I think this is caused by the fact that we apply Autocomplete to all RichText components. It existed before, but was only the case for Paragraph block.

Those divs are indeed due to Autocomplete being added to RichText:

@gziolo and I were not pleased with these additions but did not see a better solution at the time. I'm hoping that React will eventually support specifying event listeners on Fragments as mentioned in the React 16.2 fragment support post:

In the future, we may add support for additional attributes, such as event handlers.

@rwrobe
Copy link
Author

rwrobe commented Apr 17, 2018

Does this mean that the divs are here to stay until there are updates to React? If so, can we add a class or wrapper so we can target these divs without having to use nth-child selectors in CSS?

@gziolo
Copy link
Member

gziolo commented Apr 17, 2018

We will take a closer look if we can limit the number of divs that are there before Gutenberg gets merge into WordPress core. 👍

@danielbachhuber danielbachhuber added this to the WordPress 5.0 milestone May 18, 2018
@danielbachhuber
Copy link
Member

Related #6839

@ZebulanStanphill
Copy link
Member

#7477 removed some unneeded wrapping <div>s from Paragraph blocks.

@mtias
Copy link
Member

mtias commented Jul 19, 2018

Closing this as there's been some changes on the HoC wrappers. If there's anything specific still causing issues, please, open new issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

7 participants