Make WordPress Core


Ignore:
Timestamp:
05/07/2021 11:17:33 PM (3 years ago)
Author:
joedolson
Message:

Media: Remove infinite scroll from media library and modal.

Replace infinitely autoloading behavior on scroll with a user-controlled load more button. Fix a long standing accessibility issue in the media library. Infinite scroll poses a wide range of problems for accessibility, usability, and performance.

This change modifies the library to load 40 items in the initial view, with a load more button to load the next 40 items and a button to move focus from the load more region to the first of the most recently added items.

The text for communicating the jump target was broadly discussed, agreeing that the text incorporated here would most concisely and clearly convey the purpose of the button, and any further detail is learnable from use.

Props afercia, adamsilverstein, joedolson, audrasjb, francina
Fixes #50105. See #40330.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r50556 r50829  
    29942994    $posts = array_filter( $posts );
    29952995
    2996     wp_send_json_success( $posts );
     2996    $result = array(
     2997        'attachments'      => $posts,
     2998        'totalAttachments' => $query->found_posts,
     2999    );
     3000
     3001    wp_send_json_success( $result );
    29973002}
    29983003
Note: See TracChangeset for help on using the changeset viewer.