Opened 9 years ago
Last modified 21 months ago
#36012 assigned enhancement
Add .current-ancestor class to any relative menu item ancestor
Reported by: | vovkasolovev | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 4.4.2 |
Component: | Menus | Keywords: | needs-unit-tests has-patch |
Focuses: | template | Cc: |
Description
Right now there is .current-page-ancestor and .current-post-ancestor for pages and posts and no any class for archives, category, taxonomy or custom post types ancestors added to items in nav-menu.
I think it will be usefull, for indication navigation depth purposes, to add .current-ancestor class to ANY menu item if "current page" is child/successor to anything in menu (parents, archive, category, taxonomy etc. menu items).
Attachments (3)
Change History (15)
This ticket was mentioned in Slack in #accessibility by afercia. View the logs.
8 years ago
This ticket was mentioned in Slack in #accessibility by afercia. View the logs.
8 years ago
#3
@
8 years ago
- Owner set to SergeyBiryukov
- Status changed from new to assigned
- Type changed from feature request to enhancement
This ticket was mentioned in Slack in #accessibility by afercia. View the logs.
6 years ago
#10
follow-up:
↓ 11
@
6 years ago
- Keywords has-patch added; needs-patch removed
The patch is really simple, instead of just adding this class for page, it add it for all custom post types and taxonomies.
Is unit tests really needed ?
#11
in reply to:
↑ 10
@
6 years ago
Replying to Mista-Flo:
The patch is really simple, instead of just adding this class for page, it add it for all custom post types and taxonomies.
Sorry, If you decide to add specific type, maybe we can add both:
.current-ancestor and .current_%s_ancestor
Similar how we have with item classes:
.menu-item and .menu-item-type-taxonomy.
Reason to have short .current-ancestor (without %argument) for all the parents is to be able to select and to stylize menu items in bread crumbs way, without specifying their type, level or something else.
#12
follow-up:
↓ 13
@
6 years ago
Yeah sure it makes sense but you already have the general class "current-menu-ancestor", so I guess it's what you want.
By the way, I have added a new patch just for refactoring purpose, tried to merge some if state to avoid extra code lines.
#13
in reply to:
↑ 12
@
6 years ago
Replying to Mista-Flo:
Yeah sure it makes sense but you already have the general class "current-menu-ancestor", so I guess it's what you want.
Sorry, that is what I asked for. Right now there is no "current-menu-ancestor" (or "current-ancestor" as I named it) for CPT and archives. They have only type-related classes like "current-post-ancestor".
Replying to JeffPaul:
Patiently waiting for the .current-ancestor tag to indicate selected item in menu for archives, category, taxonomy and custom post types pages.