WordPress.org

Make WordPress Core

Opened 23 months ago

Last modified 5 months ago

#42763 new enhancement

class-wp-list-table unnecessarily disables first and last pagination buttons

Reported by: wp_kc Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.1
Component: General Keywords: has-patch reporter-feedback needs-refresh
Focuses: ui, administration Cc:
PR Number:

Description

protected function pagination($which) in class-wp-list-table.php unnecessarily disables the << pagination button if you are on page 2 and disabled the >> pagination button if you are on the next to last page. That seems a bit pedantic and completely unnecessary.

If I am on page 2 of a multi-page list, I should be able to click either << or < to get back to the first page. If I am on the next to last page, I should be able to click either > or >> to get to the last page. It does not make sense to disable buttons that should logically work in these two conditions.

The following code starting at line 743 of class-wp-list-table.php...

<?php
                if ( $current == 1 ) {
                        $disable_first = true;
                        $disable_prev = true;
                }
                if ( $current == 2 ) {
                        $disable_first = true;
                }
                if ( $current == $total_pages ) {
                        $disable_last = true;
                        $disable_next = true;
                }
                if ( $current == $total_pages - 1 ) {
                        $disable_last = true;
                }

...should be changed too...

<?php
                if ( $current == 1 ) {
                        $disable_first = true;
                        $disable_prev = true;
                }
                if ( $current == $total_pages ) {
                        $disable_last = true;
                        $disable_next = true;
                }

Attachments (2)

42763.patch (1018 bytes) - added by ronakganatra 23 months ago.
Agree with wp_kc there is not need of more conditions regarding this functionality and applied patch for it .
42763.diff (1018 bytes) - added by ronakganatra 23 months ago.

Download all attachments as: .zip

Change History (8)

#1 @wp_kc
23 months ago

  • Severity changed from normal to trivial

@ronakganatra
23 months ago

Agree with wp_kc there is not need of more conditions regarding this functionality and applied patch for it .

@ronakganatra
23 months ago

#2 @ronakganatra
23 months ago

  • Keywords has-patch added
  • Severity changed from trivial to normal

#3 @wp_kc
6 months ago

  • Keywords reporter-feedback added

I haven't tracked down where or why it happened... but the code was reverted back to its original form; the extra if() statements are back.

#4 @wp_kc
5 months ago

  • Keywords needs-refresh added
  • Version 4.9.1 deleted

#5 @wp_kc
5 months ago

  • Version set to trunk

#6 @knutsp
5 months ago

  • Version changed from trunk to 4.9.1
Note: See TracTickets for help on using tickets.