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 compatibility issue #806

Closed
billerickson opened this issue Dec 15, 2018 · 3 comments
Closed

Gutenberg compatibility issue #806

billerickson opened this issue Dec 15, 2018 · 3 comments
Labels

Comments

@billerickson
Copy link

When Shortcode UI is active in WordPress 5.0 or higher, it triggers a php notice:

PHP Notice: edit_form_advanced is deprecated since version 5.0.0! Use block_editor_meta_box_hidden_fields instead. This action is still supported in the classic editor, but is deprecated in the block editor.

This PHP notice then triggers Gutenberg to load in “Quirks Mode”, which leads to additional issues like metaboxes appearing on top of blocks in the editor. Shortcode UI must be deactivated to make the block editor usable.

screenshot

Here’s a detailed report on the issue: WordPress/gutenberg#12598

@kadamwhite
Copy link

I'm also seeing the same quirks mode issue apply on a site that isn't noticeably displaying that error; in our case, it's the Shortcake JS templates which are being output too early.

<script type="text/html" id="tmpl-fusion-shortcake-field-attachment">
<div class="field-block shortcode-ui-field-attachment shortcode-ui-attribute-{{ data.attr }}">
  <label for="{{ data.attr }}">{{{ data.label }}}</label>
  <# if ( typeof data.description=='string' ) { #>
    <p class="description">{{{ data.description }}}</p>
    <# } #>
      <button id="{{ data.attr }}" class="shortcake-attachment-select button button-small add">{{ data.addButton }}</button>
      <div class="attachment-previews"></div>
</div>
</script>

and so on. I would expect these to get output within the <head> or <body> of the page, not before <!doctype>

goldenapples added a commit that referenced this issue Jan 16, 2019
As noted in #806, the pattern used for many of the Shortcake attribute
fields which output custom field templates is to output those templates
on the `shortcode_ui_loaded_editor` hook. In WP 5.0 with the block
editor active, this hook fires before the page output is begun, which
causes these script templates to be spit out before the opening
<doctype> tag, causing all kinds of ruckus with the browser layout.

Specifically, any output before the <doctype> declaration forces
browsers into quirks mode, which renders the flex layout required for
the Gutenberg editor incorrectly. In practive this was causing meta
boxes to float awkwardly over editor content.

This fixes the problem by, instead of outputting the templates on the
`shortcode_ui_loaded_editor` hook, instead attaching a hook to a later
action to output these templates in the admin footer.
@kasparsd
Copy link

This appears to have been fixed in #807. Should this be marked as closed?

@goldenapples
Copy link
Contributor

Yup, closing now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants