WordPress.org

Make WordPress Core

Opened 2 months ago

Closed 6 weeks ago

Last modified 3 weeks ago

#53827 closed enhancement (fixed)

Increase number of media items displayed when clicking button to "Load More"

Reported by: antpb Owned by: antpb
Milestone: 5.8.1 Priority: normal
Severity: normal Version: 5.8
Component: Media Keywords: has-patch commit fixed-major
Focuses: accessibility Cc:

Description

In #50105 a "Load More" button was introduced to improve the experience for more people. It has been reported in various forms of feedback that the number of items displayed when clicking "Load More" is too low.

We should consider increasing this number in 5.8.x to load more attachments so folks can get through their Media Library faster as we prepare to make this setting more configurable in 5.9 or later. It's worth noting that the aim of the experience we're trying to emulate is the ability folks once had to navigate to a deeper page than "next batch."

#53787 has been created to handle the configurable bits of this feature.

Attachments (2)

53827.diff (330 bytes) - added by antpb 7 weeks ago.
Increases per page count for load more to 80
53827-diff-test.png (84.8 KB) - added by hellofromTonya 7 weeks ago.
Testing 53827.diff patch - works as expected ✅

Download all attachments as: .zip

Change History (26)

#1 @antpb
2 months ago

  • Summary changed from Increase number of media items displayed when clicking button to display more to Increase number of media items displayed when clicking button to "Load More"

#2 @joedolson
2 months ago

  • Focuses accessibility added

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


2 months ago

#4 @joedolson
2 months ago

This doesn't really have any accessibility issues related to it, but I want the accessibility team to be aware of this.

#5 @peterwilsoncc
8 weeks ago

At the moment each page is 40 images, do you have any thoughts about how much that should be increased? My instinct is 60 or 80 but that could still be seen as too low for sites with enormous media libraries.

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


8 weeks ago

#7 @antpb
8 weeks ago

I agree with double the default (80) as a temporary solution so folks can load more and get through their libraries faster.

#8 @antpb
8 weeks ago

  • Owner set to antpb
  • Status changed from new to assigned

This ticket was mentioned in Slack in #core-media by pbiron. View the logs.


8 weeks ago

#10 follow-up: @peterwilsoncc
8 weeks ago

I've noticed the default value is hard coded in the JavaScript default options without an filter.

I think allowing devs to filter this would be appreciated, is it possible to either:

  • use @wordpress/hooks to add a filter in JavaScript
  • cease sending the default value and setting it in wp_ajax_query_attachments() so developers can set the default value in PHP? The filter ajax_query_attachments_args already exists but sending the requested arguments as a second parameter would probably be needed so devs can figure out if the value in $query is the default or coming from the ajax request.

#11 @AlGala
7 weeks ago

  • Type changed from defect (bug) to enhancement

Hi,

I would like to add a suggestion here that while making the default 80 rather than 40 would be quite helpful, it would be nice to have a button that could automatically take the user to the bottom of their media library - like a 'Jump to the End' button. So if we know we are looking for something near the bottom of the list, we can jump right to that area without needing to expand the media library multiple times.

Edit - I'm sorry this is the first time I've ever added a comment into this area, so I did not realize I changed the type from defect (bug) to enhancement

Last edited 7 weeks ago by AlGala (previous) (diff)

#12 in reply to: ↑ 10 ; follow-up: @antpb
7 weeks ago

Replying to peterwilsoncc:

I've noticed the default value is hard coded in the JavaScript default options without an filter.

I think allowing devs to filter this would be appreciated, is it possible to either:

  • use @wordpress/hooks to add a filter in JavaScript
  • cease sending the default value and setting it in wp_ajax_query_attachments() so developers can set the default value in PHP? The filter ajax_query_attachments_args already exists but sending the requested arguments as a second parameter would probably be needed so devs can figure out if the value in $query is the default or coming from the ajax request.

I think this is a great idea. We may want to reserve it for a separate ticket to handle the filter as this issue is aiming to be added in the next minor release. I could be wrong, but I believe we cannot add new filters unless in a major point release. Happy to add that to the scope of this ticket if I'm wrong! :)

@antpb
7 weeks ago

Increases per page count for load more to 80

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


7 weeks ago

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


7 weeks ago

#15 @hellofromTonya
7 weeks ago

  • Keywords has-patch needs-testing added; needs-patch removed

Adding to my testing queue. Testing report coming shortly, though the patch is a safe change (since it's a hard-coded default value).

@hellofromTonya
7 weeks ago

Testing 53827.diff patch - works as expected ✅

#16 @hellofromTonya
7 weeks ago

  • Keywords needs-testing removed

Test Report

Env

  • WordPress: 5.8.0
  • Browser: Chrome 92.0.4515.131
  • OS: macOS Big Sur 11.5
  • Localhost: Local and wp-env
  • Theme: Twenty Twenty-One
  • Plugins: none
  • Scripts: none

Steps to Test

  • Add at least 80 items into the Media Library (okay to copy same items over and over again)
  • Refresh the Media Library page in the browser
  • Scroll down to the Load more button
  • Notice the Showing 40 of xx media items message
  • Apply 53827.diff patch
  • Refresh the Media Library page in the browser
  • Scroll down to the Load more button
  • Notice the Showing 80 of xx media items message and the number of media items rendered is doubled

Test Results

As shown in 53827-diff-test.png, the patch works as expected ✅

#17 @hellofromTonya
7 weeks ago

  • Keywords commit added

@antpb 53827.diff works as expected. Marking for commit.

This ticket was mentioned in Slack in #core-media by hellofromtonya. View the logs.


7 weeks ago

#19 @SergeyBiryukov
7 weeks ago

#53919 was marked as a duplicate.

#20 in reply to: ↑ 12 @peterwilsoncc
7 weeks ago

Replying to antpb:

I think this is a great idea. We may want to reserve it for a separate ticket to handle the filter as this issue is aiming to be added in the next minor release. I could be wrong, but I believe we cannot add new filters unless in a major point release. Happy to add that to the scope of this ticket if I'm wrong! :)

Yes, let's do it in a follow up for a major release. Sometimes filters are added in minors but only as bug fixes and this is an enhancement.

#21 @peterwilsoncc
6 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 51632:

Media: Increase number of media items displayed per page.

Increase the number of media items displayed per page from 40 to 80 to improve the experience for users navigating the library on sites with a large quantity of media in the library.

Props AlGala, antpb, hellofromTonya, joedolson, SergeyBiryukov, wb1234.
Fixes #53827.

#22 @peterwilsoncc
6 weeks ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for merging in to the 5.8 branch.

#23 @desrosj
6 weeks ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 51643:

Media: Increase number of media items displayed per page.

Increase the number of media items displayed per page from 40 to 80 to improve the experience for users navigating the library on sites with a large quantity of media in the library.

Props AlGala, antpb, hellofromTonya, joedolson, SergeyBiryukov, wb1234, peterwilsoncc.
Merges [51632] to the 5.8 branch.
Fixes #53827.

This ticket was mentioned in Slack in #core-test by hellofromtonya. View the logs.


3 weeks ago

Note: See TracTickets for help on using tickets.