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

Javascript error when resetting Font Size Presets #65774

Closed
2 tasks done
benniledl opened this issue Oct 1, 2024 · 11 comments · Fixed by #65791
Closed
2 tasks done

Javascript error when resetting Font Size Presets #65774

benniledl opened this issue Oct 1, 2024 · 11 comments · Fixed by #65791
Assignees
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@benniledl
Copy link
Contributor

Description

Hello all!

I've got a javascript error and the editor crashed when doing the following:

Step-by-step reproduction instructions

  1. opening global styles
  2. typography
  3. font size presets
  4. add a new individual font size preset
  5. click on the new individual preset
  6. next to the revisions button click on the 3 dots
  7. click reset styles

Screenshots, screen recording, code snippet

TypeError: f is undefined
Kh https://hostingtools.at/wordpress/wp-includes/js/dist/edit-site.min.js?ver=5a21c7ca87b2d5588902:11
ht https://hostingtools.at/wordpress/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.3.1:10
vr https://hostingtools.at/wordpress/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.3.1:10
Qs https://hostingtools.at/wordpress/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.3.1:10
wl https://hostingtools.at/wordpress/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.3.1:10
bl https://hostingtools.at/wordpress/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.3.1:10
yl https://hostingtools.at/wordpress/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.3.1:10
il https://hostingtools.at/wordpress/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.3.1:10
fl https://hostingtools.at/wordpress/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.3.1:10
Nn https://hostingtools.at/wordpress/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.3.1:10
ul https://hostingtools.at/wordpress/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.3.1:10
[react-dom.min.js:10:53523]

Blog-Startseite.Template.Testsite.Editor.WordPress.Mozilla.Firefox.2024-10-01.09-57-40.mp4

Environment info

Firefox,
completely fresh and unmodified WordPress 6.7-beta1

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
@benniledl benniledl added the [Type] Bug An existing feature does not function as intended label Oct 1, 2024
@firoz2456
Copy link

firoz2456 commented Oct 1, 2024

Yes, I am getting the same error with fresh installation of WordPress 6.7-beta1
Google Chrome
PHP 8.1.29
nginx
LocalWP
image

@nith53
Copy link

nith53 commented Oct 1, 2024

I was also able to replicate it.
font=preset-error

@t-hamano
Copy link
Contributor

t-hamano commented Oct 1, 2024

Thanks for the report. The error log when SCRIPT_DEBUG is enabled is as follows:

Uncaught TypeError: Cannot read properties of undefined (reading 'fluid') at FontSize (font-size.js:57:12)

Resetting the global styles discards any custom font size presets. This would cause a critical error, as the font size preset panel is built around the assumption that the font preset exists.

Perhaps the ideal solution would be to switch back from the specific preset panel to the previous screen, i.e. the preset list panel, when the global styles are reset.

cc @matiasbenedetto @mikachan

@t-hamano t-hamano added the Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json label Oct 1, 2024
@benniledl
Copy link
Contributor Author

benniledl commented Oct 1, 2024

Remove the "Reset styles" button

I think the reset styles button should be removed from the specific preset panel (clicking on a preset) and moved to the overview of all presets.

Because having a reset styles button on this specific preset panel could imply that you are only resetting this one (currently selected) preset and not every preset.

Remove from here (since it implies that reset is only affecting currently selected preset):

Screenshot 2024-10-01 at 13-48-51 Blog-Startseite ‹ Template ‹ Testsite ‹ Editor — WordPress

Only leave it here:

Screenshot 2024-10-01 at 13-49-18 Blog-Startseite ‹ Template ‹ Testsite ‹ Editor — WordPress

@matiasbenedetto matiasbenedetto moved this to 🏗️ In Progress in WordPress 6.7 Editor Tasks Oct 1, 2024
@matiasbenedetto matiasbenedetto self-assigned this Oct 1, 2024
@matiasbenedetto
Copy link
Contributor

I think the reset styles button should be removed from the specific preset panel (clicking on a preset) and moved to the overview of all presets.

Because having a reset styles button on this specific preset panel could imply that you are only resetting this one (currently selected) preset and not every preset.

Remove from here (since it implies that reset is only affecting currently selected preset):

I think this makes sense, but it's out of the scope of this particular bug because it will impact all the styles / presets.

@t-hamano
Copy link
Contributor

t-hamano commented Oct 1, 2024

@matiasbenedetto I have filed #65765 to resolve a different issue with font size presets (and shadow presets). #65765 does not need to be backported to WP 6.7, but the fix for this issue does need to be backported to WP 6.7, so it might be better to fix this issue before merging #65765.

@matiasbenedetto
Copy link
Contributor

A potential fix for this particular bug: #65791

@matiasbenedetto
Copy link
Contributor

@matiasbenedetto I have filed #65765 to resolve a different issue with font size presets (and shadow presets). #65765 does not need to be backported to WP 6.7, but the fix for this issue does need to be backported to WP 6.7, so it might be better to fix this issue before merging #65765.

Sorry for the overlap I will take a look.

@nith53
Copy link

nith53 commented Oct 1, 2024

Is a trac ticket needed for the backport? @t-hamano

@t-hamano
Copy link
Contributor

t-hamano commented Oct 2, 2024

@nith53 No, the fix will be automatically cherry-picked and committed to the wp/6.7 branch and will be bundled in the next beta release.

@benniledl
Copy link
Contributor Author

Hello @ciampo @t-hamano @matiasbenedetto

Some similar behavior applies to Shadows, if you reset the styles and then keep editing the currently selected shadow there is an error.
A new ticket for this: #65930

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants