[wp-trac] [WordPress Trac] #54091: Attachment details pane navigation not working after opening 81st (or greater) item and refreshing the browser

WordPress Trac noreply at wordpress.org
Thu Feb 15 18:47:30 UTC 2024


#54091: Attachment details pane navigation not working after opening 81st (or
greater) item and refreshing the browser
--------------------------------------+-----------------------------
 Reporter:  ppetrov2c                 |       Owner:  antpb
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  6.5
Component:  Media                     |     Version:  5.8
 Severity:  trivial                   |  Resolution:
 Keywords:  needs-patch dev-feedback  |     Focuses:  ui, javascript
--------------------------------------+-----------------------------

Comment (by antpb):

 Added a patch here. When the library index exceeds the count that is
 displayed on refresh, it returns an index value of -1. If we click the
 first item in the media library, the index value correctly shows 0 which
 then gets `-1` in the hasPrevious check and sets `hasPrevious` to false.
 In the case of the out of range index, the -1 gets -1 and becomes -2 so we
 can safely check for an initial value of -1 and deduce that it is outside
 the range of initial load and does indeed have previous items.

 Trying to think of cases where -1 will incorrectly assume previous.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54091#comment:31>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list