Make WordPress Core

Opened 6 years ago

Last modified 3 years ago

#37165 new defect (bug)

Problem bulk actions is disabled

Reported by: sebastian.pisula Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Quick/Bulk Edit Keywords: has-screenshots has-patch bulk-reopened
Focuses: ui Cc:


I have this filter: add_filter( 'bulk_actions-{$this->screen->id}', '__return_empty_array' ); and in page I have space because I have empty div:

<div class="alignleft actions bulkactions"></div>

Problem is in wp-admin/includes/class-wp-list-table.php:1182:

 if ( $this->has_items() ): ?>
                <div class="alignleft actions bulkactions">
                        <?php $this->bulk_actions( $which ); ?>
                <?php endif;

Attachments (3)

space.png (2.8 KB) - added by sebastian.pisula 6 years ago.
37165.diff (1.1 KB) - added by andizer 5 years ago.
37165.2.diff (1.2 KB) - added by mariovalney 3 years ago.

Download all attachments as: .zip

Change History (11)

#1 @afercia
5 years ago

  • Component changed from General to Administration
  • Focuses ui added
  • Keywords has-screenshots needs-patch added
  • Milestone changed from Awaiting Review to Future Release

Ideally empty elements shouldn't be printed out, worth investigating what can be done on the PHP side. Alternatively a CSS-only solution could work.

#2 @SergeyBiryukov
5 years ago

  • Component changed from Administration to Quick/Bulk Edit

5 years ago

#3 @andizer
5 years ago

Just added a patch to solve this. Feedback is welcome.

#4 @andizer
5 years ago

  • Keywords has-patch added; needs-patch removed

#5 @andizer
5 years ago

  • Keywords needs-testing added

#6 @flixos90
5 years ago

Hi @andizer, the patch looks good in my opinion as far as it fixes the issue. :)
We might need to be careful with the change since when the bulk_actions() method is overridden in a subclass, the change could lead to issues since the wrapping div would be gone then. On the other hand, I think it's rather unlikely to override this method since one should preferably use get_bulk_actions() for that purpose, so I tend to say we're fine applying this change. I'm just thinking out loud here to make sure we consider this possibility.

#7 @afercia
5 years ago

Even if the bulk actions div is not printed out, the wrapper .tablenav has always a fixed height of 30px, so the empty space will still be there, unless I'm missing something. .tablenav can also contain the pagination links and the number of items, not to mention additional filters.

3 years ago

#10 @mariovalney
3 years ago

  • Keywords bulk-reopened added; needs-testing removed

To keep tabnav structure inside display_tablenav() method, I guess we can remove the empty space created and add a CSS :empty rule to display none this section.

I added 37165.2.diff with this in mind.

Note: See TracTickets for help on using tickets.