You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Metaboxes are placed in incorrect position when switching device preview #38062
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
Reacted by ddryo, tomoki shimomura, Swennet and Stefan Fisk
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
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.
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.
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.
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?
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:
Create a new page, write a title, and put a 5 paragraph Lorem Ipsum text (so it's quite long).
Switch to "Tablet" or "Mobile" view, then back to "Desktop".
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.
Activity
[-]Metabox is placed in incorrect position When switching device preview[/-][+]Metaboxes are placed in incorrect position when switching device preview[/+]ddryo commentedon Jan 19, 2022
I was able to reproduce it too.
ddryo commentedon Jan 25, 2022
I can still reproduce it with 5.9-RC4.
nendeb commentedon Jan 30, 2022
It is also reproduced in WP5.9 Custom Post Type.
ddryo commentedon Jan 31, 2022
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.
carolinan commentedon Feb 4, 2022
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.
jasmussen commentedon Feb 4, 2022
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.
peterwilsoncc commentedon Feb 14, 2022
I've moved this to the 5.9.x project to match the ticket filed on trac.
amboutwe commentedon Feb 17, 2022
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
carolinan commentedon Feb 18, 2022
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?
stefanfisk commentedon Mar 15, 2022
Adding this to my block editor styles (
enqueue_block_editor_assets) seems to work around the issue:t-hamano commentedon Mar 25, 2022
I tested again on the latest branch after #38910 was merged, and all of the following themes work fine:
So I am closing this issue.
@carolinan
Thank you for your work !
quantumleap33 commentedon Apr 6, 2022
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:
Twenty Twenty and Twenty Twenty-One theme: The metabox overlays the content in the middle of the visible pane.
t-hamano commentedon Apr 6, 2022
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.
Mamaduka commentedon Apr 6, 2022
The PR wasn't labeled for backporting; it is why WordPress 5.9.3 didn't include it.
peterwilsoncc commentedon Apr 6, 2022
@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?
Mamaduka commentedon Apr 7, 2022
@peterwilsoncc tentatively added the label to the PR.
darkonelson commentedon Apr 12, 2022
It happens to me too. Astra theme and UAG blocks after WP5.9 version.
And after 5.9.3 problem remains the same.
carolinan commentedon Apr 13, 2022
@darkonelson Correct, the fix ix not in WordPress 5.9.3. It is in 6.0 beta.
darkonelson commentedon Apr 13, 2022
Thank you Carolinan for your information.