WordPress.org

Make WordPress Core

Opened 5 months ago

Last modified 5 months ago

#44923 new enhancement

Filter .children class on nested comments list

Reported by: greenshady Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Comments Keywords: needs-patch
Focuses: Cc:

Description

The start_lvl() method of Walker_Comment should have a filter hook to customize the .children class. This will allow theme authors to utilize their preferred system or CSS framework for handling nested comment lists. And, .children is generic and requires writing nested CSS selectors to target it.

This change would put the comment walker on par with the nav menu walker, where we have the nav_menu_submenu_css_class filter hook.

Attachments (1)

44923.patch (953 bytes) - added by Shizumi 5 months ago.

Download all attachments as: .zip

Change History (6)

This ticket was mentioned in Slack in #themereview by greenshady. View the logs.


5 months ago

#2 @joyously
5 months ago

I'm all for parity, but when I tried to make my menu work with CSS only, I had to insert elements at the parent level of the submenu, not at the child level. So while this filter would be good for comments, it would have the same problem of not being able to inject something at the parent level, which is how you have to work with CSS.

In my case, I had to supply an entire nav walker class just to output a small piece of HTML to be able to trigger the submenus. Comments are a bit less dynamic, but same nested lists.

What I'm saying is: is a filter enough?

#3 @greenshady
5 months ago

Yes, a filter is plenty when all you need to do is alter a class.

It sounds like the issues you're describing are out of scope for this proposed enhancement.

#4 @SergeyBiryukov
5 months ago

  • Keywords needs-patch added

@Shizumi
5 months ago

#5 @Shizumi
5 months ago

I made a patch.
Because it is the first time, please let me know if there is a shortage.

Note: See TracTickets for help on using tickets.