Skip to content

Metaboxes are placed in incorrect position when switching device preview #38062

Closed

Description

@t-hamano

Description

The metaboxes are stuck over the content when I change the device preview to mobile / tablet and then change it back to desktop preview again.

Step-by-step reproduction instructions

First, enabe Custom Fields metaboxes from 'options > Preferences > Panels > Custom Fields.

capture

Once you are sure that the meta box is positioned at the bottom of the content, press the 'Preview' button, switch to 'Mobile or Tablet', and then switch again to 'Desktop' preview.

Screenshots, screen recording, code snippet

b0fb24e4135b7511f876bcc4c4ec2c21.mp4

Environment info

  • WordPress version: 5.9 RC-3
  • Gutenberg version: This happened both with and without the plugin.
  • Theme: Twenty Twenty One, Twenty Twenty Two
  • Browser: Google Chrome 97.0.4692.71, Microsoft Edge 97.0.1072.62
  • OS: Windows 11

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Activity

  1. changed the title [-]Metabox is placed in incorrect position When switching device preview[/-] [+]Metaboxes are placed in incorrect position when switching device preview[/+] on Jan 19, 2022
  2. ddryo commented on Jan 19, 2022

    @ddryo
    Contributor

    I was able to reproduce it too.

  3. added
    [Feature] Meta Boxes
    [Type] Bug
    on Jan 19, 2022
  4. ddryo commented on Jan 25, 2022

    @ddryo
    Contributor

    I can still reproduce it with 5.9-RC4.

  5. nendeb commented on Jan 30, 2022

    @nendeb

    It is also reproduced in WP5.9 Custom Post Type.

  6. ddryo commented on Jan 31, 2022

    @ddryo
    Contributor

    Once the custom field overlaps the content area, we have to refresh the screen to get rid of it.

    This is very annoying because we have to refresh the screen when we are still in the middle of writing an article and don't want to save it.

  7. carolinan commented on Feb 4, 2022

    @carolinan
    Contributor

    I can reproduce this in WordPress 5.9 with and without Gutenberg trunk.
    It seems to be caused by a set height when you switch from either tablet or mobile preview to desktop:

    This is the default CSS when you view the post in desktop without first selecting a different preview:
    <div class="is-desktop-preview" style="width: 100%; margin: 0px; display: flex; flex-flow: column; background: white;">

    And this is the CSS if you switch to deskop:
    <div class="is-desktop-preview" style="width: 100%; margin: 0px auto; display: flex; flex-flow: column; background: white; height: 761px; border-radius: 0px; border: 0px none rgb(60, 67, 74); overflow-y: visible;">

    If I remove this height in the browser inspector tools, the meta boxes are placed correctly.

    I was not able to pin point where exactly the height is from:
    I believe part of the style is generated from https://github.com/WordPress/gutenberg/blob/trunk/packages/edit-post/src/components/visual-editor/index.js#L126

    But there is a comment stating that We intentionally omit a 100% height here.
    This made me uncertain because if we are omitting the height here, what is adding the 761px height in the inline CSS?

    I looked through useResizeCanvas but it does not set this height.

    Related: #33817

    Pinging @jasmussen since you worked on the related issue in Safari.

  8. jasmussen commented on Feb 4, 2022

    @jasmussen
    Contributor

    Thanks for the ping. As I recall, the Safari issue was related to a browser bug or rule interpretation. But with the steps you share I can reproduce in Chrome as well, and so it seems the right solution is to remove some of those extra properties that are applied. I'm not entirely sure if you worked on it, @ellatrix, so feel free to ignore, but I have a feeling you have an idea.

  9. peterwilsoncc commented on Feb 14, 2022

    @peterwilsoncc
    Contributor

    I've moved this to the 5.9.x project to match the ticket filed on trac.

  10. amboutwe commented on Feb 17, 2022

    @amboutwe

    I reproduced the issue in a new local install with no plugins and the Twenty Twenty-One (2021) theme. The behavior does not happen in WP 5.8.2, so it's a regression. It also happens with the new Twenty Twenty-Two theme.
    ​
    ​Screencasts using 2021 theme:
    ​WP 5.8.2 https://drive.google.com/file/d/1TKvN46Hn8BfU67x2iA6E6mumg9wBvf1w/view
    WP 5.9 ​https://drive.google.com/file/d/1H3vNznRxFkSh5TsdVjuSLXf9kLYIbye_/view

  11. carolinan commented on Feb 18, 2022

    @carolinan
    Contributor

    I can set the height to 100%, which seems to solve the problem, but I can't test on Safari 13. I'm new to mac and the installed Safari version is 15.3. There does not seem to be a safe way to downgrade?

  12. stefanfisk commented on Mar 15, 2022

    @stefanfisk
    Contributor

    Adding this to my block editor styles (enqueue_block_editor_assets) seems to work around the issue:

    // Workaround for https://github.com/WordPress/gutenberg/issues/38062
    .is-desktop-preview {
        height: 100% !important;
    }
    
  13. t-hamano commented on Mar 25, 2022

    @t-hamano
    ContributorAuthor

    I tested again on the latest branch after #38910 was merged, and all of the following themes work fine:

    • Twenty Twenty Two
    • Twenty Twenty One
    • Twenty Twenty

    So I am closing this issue.

    @carolinan
    Thank you for your work !

  14. quantumleap33 commented on Apr 6, 2022

    @quantumleap33

    After further testing on WP 5.9.3, I can confirm that the issue has NOT been resolved in any of the themes mentioned, and no plugins installed.

    Step to reproduce:

    1. Create a new page, write a title, and put a 5 paragraph Lorem Ipsum text (so it's quite long).
    2. Switch to "Tablet" or "Mobile" view, then back to "Desktop".
    3. Twenty Twenty-Two theme: The custom fields meta box covers the bottom part of the content.
      Twenty Twenty and Twenty Twenty-One theme: The metabox overlays the content in the middle of the visible pane.
  15. t-hamano commented on Apr 6, 2022

    @t-hamano
    ContributorAuthor

    Hi @quantumleap33,

    This issue has been fixed in PR #38910.
    It has been fixed in the Gutenberg trunk, but I think it hasn't been backported in WordPress 5.9.3.

    I believe this PR should have been backported to 5.9.3, but my closing this issue might be the reason it was not backported.

    @peterwilsoncc
    @carolinan
    If you have any advice on the best way to handle this, please advise.

  16. Mamaduka commented on Apr 6, 2022

    @Mamaduka
    Member

    The PR wasn't labeled for backporting; it is why WordPress 5.9.3 didn't include it.

  17. peterwilsoncc commented on Apr 6, 2022

    @peterwilsoncc
    Contributor

    @audrasjb Do you think there will be a 5.9.4 at this stage?

    @Mamaduka If the answer comes back yes, are you able to apply the appropriate labels, etc?

  18. Mamaduka commented on Apr 7, 2022

    @Mamaduka
    Member

    @peterwilsoncc tentatively added the label to the PR.

  19. darkonelson commented on Apr 12, 2022

    @darkonelson

    It happens to me too. Astra theme and UAG blocks after WP5.9 version.
    And after 5.9.3 problem remains the same.

  20. carolinan commented on Apr 13, 2022

    @carolinan
    Contributor

    @darkonelson Correct, the fix ix not in WordPress 5.9.3. It is in 6.0 beta.

  21. darkonelson commented on Apr 13, 2022

    @darkonelson

    Thank you Carolinan for your information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Meta Boxes[Type] Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions