-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Font Library: Improve 'No fonts installed' state when fonts are installed but not activated #63533
Conversation
Size Change: +27 B (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
To ideally resolve #63418, I think the following two things also need to be addressed:
The button that opens the modal dialog text is 'Add fonts'.
The button to open the modal dialog brings users to the 'Upload' tab. It would be best to bring users to the 'Library' tab.
In this PR, the text is correct when there are no fonts activated, but the button text is "Add fonts":
The button text should be "Manage fonts" and the tab that opens when you click the button should be "Installed fonts".
Additionally, the following scenarios need to be considered:
- No theme fonts
- Installed fonts are present
- All installed fonts are deactivated
In this case, the text should be "No fonts activated." and the button text should be "Manage fonts", but this is not the case in this PR.
@@ -39,6 +44,7 @@ function FontFamilies() { | |||
.sort( ( a, b ) => a.name.localeCompare( b.name ) ) | |||
: []; | |||
const hasFonts = 0 < customFonts.length || 0 < themeFonts.length; | |||
const hasBaseFonts = baseFontFamilies?.theme?.length > 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conditional is not enough to know if there are fonts installed but not activated. Currenty, this only checks if the theme provides fonts that are not activated but it doesn't check if there are custom fonts installed but they are not activated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right; it's likely possible that the only available fonts are custom ones that haven't been activated. I'll update the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @t-hamano
ill create separate issue for this. |
I don't know why the E2E tests succeed locally, I think it's because the button text should be "Manage Fonts" but it's "Add Fonts". The failing test is here, and below is a video of running the test manually. a02dd1590e7b24ea8f7597b36006b4f7.mp4To run the test manually, visit You will notice that the button text is unintentionally "Add Fonts". So maybe there's something missing in the current implementation. |
@t-hamano It works fine now Index-.-Template-.-gutenberg-.-Editor-.-WordPress.1.webm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! For me everything is working as expected.
All tests pass, so I think we can ship this PR.
What?
Fixes #63418
Why?
Styles panel shows a 'No fonts installed.` text event when fonts are installed, but not activated.
How?
Added condition to display message conditionally. Now it will display 'No fonts activated.` when fonts are installed but not activated.
Testing Instructions