[wp-trac] [WordPress Trac] #50538: WP_Comments_List_Table should not show views that have a count of 0
WordPress Trac
noreply at wordpress.org
Sun Jul 5 17:58:06 UTC 2020
#50538: WP_Comments_List_Table should not show views that have a count of 0
---------------------------------------+-----------------------------
Reporter: pbiron | Owner: pbiron
Type: enhancement | Status: assigned
Priority: normal | Milestone: 5.5
Component: Comments | Version:
Severity: normal | Resolution:
Keywords: has-screenshots has-patch | Focuses: administration
---------------------------------------+-----------------------------
Comment (by pbiron):
[https://core.trac.wordpress.org/attachment/ticket/50538/50538.3.diff
50538.2.diff] hides views with count of 0, in such a way that `/wp-
admin/js/edit-comments.js` can show them as comments are
approved/unapproved/etc.
This solution is **very much** a kludge, and ''may not'' be worth it.
Looking for opinions on that.
1. instead of simply not outputting 0 count views in PHP (like other list
tables), it adds a `hidden` class to their `li` elements, along with CSS
to hide them
2. modifies the JS to show/hide the appropriate views when it updates
their counts
* this is complicated by the fact that the "separators" between views
are done with the text content in the `li` elements (instead of via CSS as
I think core should do it)
* because of that, it first wraps the "separators" in a `span` element,
so that it can be hidden for the last "visible" view
* one consequence of this is that there is a split second when the
screen first loads, that the separator for the last "visible" view is
displayed...and then it is hidden
I've tested this pretty thoroughly on both the `Comments` and `Dashboard`
screens, but more testing is certainly warranted.
Also, because of the kludgy nature of the solution, the the selectors (in
both the CSS and JS) are more qualified that I would normally do, but I
didn't want them to unintentionally affect anything else (e.g., a
dashboard widget added by a plugin that just happened to use `<ul
class="subsubsub">`).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50538#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list