-
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: Replace infinite scroll by pagination #58794
Conversation
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. |
Size Change: -1.59 kB (0%) Total Size: 1.71 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.
Wow, this is looking very nice :).
I have found 2 issues while testing:
- After the first pages, some of the preview images don't load.
- If you select a page from the dropdown component and click next, you navigate to page 1, and the list gets blank.
An screencast featuring both problems:
2024-02-08.12-35-54.mp4
Thank you @matiasbenedetto I have addressed that. (The select was setting the value as a string, though I'm not sure why. Easy enough to fix.) Regarding this:
I'm not sure that it's the changes here that are causing that. I've noticed the previews failing to load on most any branch I'm on lately. I'm not entirely sure why. It isn't currently reproducing for me (on this branch) though it WAS just a short while ago on another. |
Flaky tests detected in 7d28fa6. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7835496492
|
packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js
Outdated
Show resolved
Hide resolved
packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js
Outdated
Show resolved
Hide resolved
Raising the Type label from |
packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js
Outdated
Show resolved
Hide resolved
When I navigate with the keyboard and I activate the button that is meant to take me to the last page, it seems the focus is lost. |
This problem can be solved by adding |
This was addressed in this commit with the suggestion from @t-hamano |
<Button onClick={ () => setPage( 1 ) } disabled={ page === 1 }> | ||
<< | ||
<Button | ||
aria-label={ __( 'first page' ) } |
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.
It would be better to use label
, which is an API of the Button
component, instead of aria-label
.
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.
Changed buttons to use label. Kept select component using aria-label
so that the label wasn't added above the control.
packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js
Outdated
Show resolved
Hide resolved
Thank you @colorful-tones for pointing that out. I've pushed a fix. |
Confirming that the pagination no longer display if user has not accepted and opted into Google Fonts. 👍 Overall, this is a wonderful improvement and I think the pagination is a better user experience for users. I have a few follow up discussion items, but I would say that they're not blockers for this work to be merged. I'm happy to open a new issue or log somewhere else. For now, here is my list:
Some nice guidance on pagination here: https://designsystem.digital.gov/components/pagination/ |
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.
If you select a page from the dropdown component and click next, you navigate to page 1, and the list gets blank.
✔️ I can confirm that this is solved.
After the first pages, some of the preview images don't load.
This seems to be unrelated to these changes.
It would be excellent to add the accessibility improvements listed by @colorful-tones in this comment, but that doesn't seem to be mandatory for this PR.
It is testing fine on my end. I tested:
✔️ Page sizes dynamically adapt to the space available.
✔️ Navigating a font family works.
✔️ Going inside/out a font family keeps you on the same page.
✔️ Navigate to pages using buttons and dropdown components work,
✔️ Category and search filters continue working as expected.
LGTM.
This is caused by the google fonts collection being registered in core and in Gutenberg. That was already solved in Gutenberg trunk I think rebasing this branch will solve the problem in this branch too. |
…odal/font-collection.js Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
…odal/font-collection.js Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
…odal/font-collection.js Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
…odal/font-collection.js Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
4574dce
to
b5f5984
Compare
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! I left only one suggestion.
packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js
Outdated
Show resolved
Hide resolved
…odal/font-collection.js Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
I just cherry-picked this PR to the more/backports-for-beta3 branch to get it included in the next release: 3c9d2cd |
* Eliminate and render fonts with pagination instead of as a large list Co-authored-by: pbking <pbking@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: matiasbenedetto <mmaattiiaass@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org> Co-authored-by: colorful-tones <colorful-tones@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: okmttdhr <okat@git.wordpress.org>
* Eliminate and render fonts with pagination instead of as a large list Co-authored-by: pbking <pbking@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: matiasbenedetto <mmaattiiaass@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org> Co-authored-by: colorful-tones <colorful-tones@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: okmttdhr <okat@git.wordpress.org>
What?
Removes Infinite Scrolling behavior from Font Collection tab of Font Library Modal
Fixes: #58067
(Also Fixes: #58799)
Why?
Infinite scrolling behavior is not accessible for keyboard users.
How?
Calculates how many units (Font Family list items) can be rendered on the page and render only that many pages.
Adds X of Total (with X as a SELECT element) and start, previous, next, last buttons.
Testing Instructions
Navigate to the 'Install Fonts' tab
Note that rather than being presented with a scrollbar pagination buttons are presented in the modal's footer
Ensure the pagination controls work as you would expect.
While using the pagination buttons filter the lists (by category, and by name)
Select Font Families with more Font Faces than will fix without scrolling (Advent Pro is a good example).
Note that a scrollbar is used for the Font Faces.
Testing Instructions for Keyboard
Same Steps as normal instructions. The entire workflow should be achievable exclusively with the keyboard.