Opened 8 years ago
Closed 8 years ago
#37407 closed defect (bug) (fixed)
Filter button should not appear when no posts are available in list
Reported by: | juhise | Owned by: | swissspidy |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | 4.5.3 |
Component: | Administration | Keywords: | has-ux-feedback has-screenshots has-patch has-unit-tests commit |
Focuses: | ui | Cc: |
Description
When no posts are available in list then filter button should not appear like bulk action button. This filter button does not do anything, it just confuses the user.
Attachments (11)
Change History (26)
#4
@
8 years ago
- Keywords has-ux-feedback added; ux-feedback removed
@melchoyce would you consider this as a good commit to get in? I think it could be.
#5
@
8 years ago
- Milestone changed from Awaiting Review to 4.7
@michaelarestad can you please commit this as the code and patch look good to me and be great to get this one in.
#6
@
8 years ago
@karmatosed Maybe a dev committer could look at this? I'm not comfortable committing PHP.
#7
@
8 years ago
37407.diff simplifies the code and fixes the indentation. Otherwise it looks good to me.
Note that this changes behaviour for anyone hooking into the manage_posts_extra_tablenav
action and similar hooks. Probably neglectable though.
#8
@
8 years ago
@swissspidy are you cool about committing this then? Would be great to see this get in from the good work @juhise has done.
#9
@
8 years ago
- Keywords has-unit-tests added
- Owner set to swissspidy
- Status changed from new to assigned
#10
@
8 years ago
- Keywords needs-patch needs-unit-tests added; has-patch commit has-unit-tests removed
@karmatosed Unfortunately there's one big problem with the current patch: when I filter posts by a category with zero posts attached to it, the tablenav gets hidden.
To fix the original issue, the filter button without a dropdown, the whole if ( $this->has_items() )
check needs to be added to WP_Posts_List_Table::extra_tablenav()
instead.
#11
@
8 years ago
- Keywords has-patch added; needs-patch removed
I found output buffering to be the only reliable way here. Here's how 37407.3.diff looks like in action:
This ticket was mentioned in Slack in #core by dipeshkakadiya. View the logs.
8 years ago
#13
@
8 years ago
- Keywords has-unit-tests added; needs-unit-tests removed
@dipesh.kakadiya Thanks for the tests, unfortunately they also pass without the fix applied. Also note that we don't get any notification simply for uploaded attachments. You'd need to write a comment as well.
Uploaded a new patch with tests.
Thanks for this @juhise, you are absolutely right that showing a filter when there is nothing to filter isn't a good idea. I'm going to tag and recommend this is committed as your patch looks good to me.