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

The “Custom HTML” block slows down page editing #41618

Closed
VadymPogorelov opened this issue Jun 9, 2022 · 0 comments · Fixed by #42026
Closed

The “Custom HTML” block slows down page editing #41618

VadymPogorelov opened this issue Jun 9, 2022 · 0 comments · Fixed by #42026
Assignees
Labels
[Block] HTML Affects the the HTML Block [Type] Bug An existing feature does not function as intended

Comments

@VadymPogorelov
Copy link

Description

The traverseCSS() function is called to process editor styles when the page is loaded into the editor.
I’ve added some console output for demonstration: https://prnt.sc/I79b2TpavAyo and https://prnt.sc/ejkHSM4_0RMF
This usually happens once when the editor is loaded: https://prnt.sc/hNhP4_Zg1FBv

But if you add the “Custom HTML” block to the page: https://prnt.sc/jOiThPb8V4X1 then editing becomes very slow – any action on the page (moving the mouse, selecting a block, pressing any keys) occurs permanent recalculation of styles:
– right after adding the block https://prnt.sc/thSEYckbEpbE
– just moved the mouse over the page https://prnt.sc/CaSpzqu_5qyP

The test was conducted on the theme “2021” without activated plugins!

And now imagine a more designed theme with styles for 4-5 plugins and at least a couple of dozen blocks! Theme styles grow up to 400-500K, they take 1-1.2s to process and editing becomes hell!

Note the duration of the ‘focusin’ and ‘keydown’ events and the execution time of the transform_styles_transformStyles() function: https://prnt.sc/FW_o5k2cwvc1

Step-by-step reproduction instructions

  1. WordPress 6.0 is installed
  2. Theme "Twentytwenty one" is activated
  3. No plugins are activated
  4. Create a new page or post
  5. Insert any number of blocks
  6. Now insert the "Custom HTML" block
  7. After that, any actions on the page (moving the mouse, pressing keys) are accompanied by a constant recalculation of all styles connected to the editor! Sometimes several times.

Screenshots, screen recording, code snippet

No response

Environment info

WordPress 6.0
Browsers Mozilla FireFox and Google Chrome
Desktop with Windows 10

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

@kathrynwp kathrynwp added [Type] Bug An existing feature does not function as intended [Block] HTML Affects the the HTML Block labels Jun 14, 2022
@talldan talldan self-assigned this Jun 28, 2022
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jun 29, 2022
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] HTML Affects the the HTML Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants