Media: Add a checkbox to toggle infinite scrolling in the media modal - #12795
Media: Add a checkbox to toggle infinite scrolling in the media modal#12795itzmekhokan wants to merge 1 commit into
Conversation
Infinite scrolling of the attachments list can now be turned on and off at the point of use, from a checkbox rendered before the list of media items in both the media modal and the Media Library grid view. The checkbox reflects the value resolved by `wp_enqueue_media()` and overrides it for the current view only, so the `media_library_infinite_scrolling` filter and the "Infinite Scrolling" user profile option still determine the initial state. Turning the checkbox off reveals the "Load more" button and stops the scroll handler from requesting more attachments; turning it back on hides the button and resumes loading on scroll. To make room for the checkbox before the list, the attachments wrapper is now the positioned, scrolling region in both modes, rather than only when the "Load more" button is present. Fixes #65775.
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Adds a point-of-use control for infinite scrolling in the attachments browser, as a follow-up to #65564.
What the problem was:
What the fix does:
Approach and why:
Trac ticket: https://core.trac.wordpress.org/ticket/65775
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Ticket analysis, tests and generate PR. All changes were reviewed and validated by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.