-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 Modal: Reset the selected font when installing a new font #57817
Conversation
Size Change: +26 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
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 tests well for me. Left a small suggestion, but LGTM
packages/edit-site/src/components/global-styles/font-library-modal/context.js
Outdated
Show resolved
Hide resolved
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 works as advertised.
It does change the behavior of navigating between the tabs. Currently, if you navigate to a specific font + variant list in the Library tab, then you navigate to the Upload tab and install a font, then navigate back to Library, you're at the specific font where you left off.
This changes the behavior so that the Library tab is always reset after trying to install a font, even if it fails.
I think I'm okay with that, so ✅
Thanks @vcanales and @jffng for the reviews!
I'm not sure about this behaviour when the installation fails - I've changed it back so |
I think I've found a better way to handle this 👀 I've added a call to This keeps the behaviour when switching tabs the same as before, but the variant list is updated immediately. Sorry for changing my mind - this is ready for another review! 🙇 |
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 keeps the behaviour when switching tabs the same as before, but the variant list is updated immediately.
👍 Tested and verified the behaviour is same as before when switching tabs, and the variant list is updated immediately after upload.
What?
This is a small PR to reset the selected font (
libraryFontSelected
) when installing a new font.Why?
Fixes #54945.
How?
Adds a call to
setLibraryFontSelected
ininstallFont
which sets thelibraryFontSelected
tonull
.This means that when navigating back to the installed fonts list in the Font Library modal, the initial list of fonts is shown rather than the previously selected font. This also means that the list is up to date, including the latest installed font. Previously, you had to navigate back to the list of installed fonts manually in order to reset the selected font.
Testing Instructions
Screenshots or screencast
Screen.Recording.2024-01-12.at.17.51.29.mov