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

Site Editor: Fix classic theme site preview flickering #69480

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

karthikeya-io
Copy link

@karthikeya-io karthikeya-io commented Mar 6, 2025

What?

Closes #69474

Fix classic theme site preview flickering

Why?

To prevent flickering and layout shift while the page is loading

How?

Hide the site-preview until other styles are applied .

Testing Instructions

  1. Activate a classic theme
  2. Go to Appearance > Design
  3. Check the initial load of the preview, you can also check by reloading the browser.
  4. Confirm there is no appearance and disappearance of the admin bar

(Test it with Fast 4g or lower speeds in the network tab of the inspector as this issue is more prominent at lower speeds)

Testing Instructions for Keyboard

Screenshots or screencast

Before

flickering-before.mov

After

flickering-after.mov

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Mar 6, 2025
Copy link

github-actions bot commented Mar 6, 2025

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @karthikeya-io! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@karthikeya-io karthikeya-io changed the title Site Editor: Fix elements flickering while loading in classic theme s… Site Editor: Classic theme site preview flickering Mar 6, 2025
@karthikeya-io karthikeya-io changed the title Site Editor: Classic theme site preview flickering Site Editor: Fix classic theme site preview flickering Mar 6, 2025
@karthikeya-io karthikeya-io marked this pull request as ready for review March 6, 2025 18:44
Copy link

github-actions bot commented Mar 6, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: karthikeya-io <karthikeya01@git.wordpress.org>
Co-authored-by: stokesman <presstoke@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@stokesman
Copy link
Contributor

This makes sense and I like that it avoids a flash of white background before the page loads. Thanks for putting it together. 🙇

I’m hoping we can go with a solution that doesn’t use the load event because it doesn’t fire until all media on the page has loaded. Even in a media-free case, it’s later than necessary for what’s being changed in the DOM. It’s potentially much later in cases with media—although probably not too commonly or gravely.

I’ve taken a look at avoiding the load event and it wasn’t looking too simple (with JS only). My current favorite idea is to have this handled from the backend #69474 (comment).

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Feature] Style Book labels Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Style Book First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Site Editor: Classic theme site preview flickering
3 participants