Skip to content

fix(SidebarNav): apply multi-class item classes, style the label as a nav link - #309

Merged
xidedix merged 2 commits into
v5.7from
fix/sidebar-nav-title-class
Oct 19, 2026
Merged

xidedix merged 2 commits into
v5.7from
fix/sidebar-nav-title-class

Conversation

@xidedix

@xidedix xidedix commented Oct 19, 2026

Copy link
Copy Markdown
Member

A nav item class with more than one class broke the sidebar nav. On a title, renderer.addClass(host, 'a b') threw InvalidCharacterError and c-sidebar-nav rendered none of its items; on labels, badges and icons the string went in as a single [class] key, which Angular drops, so nothing was applied.

The title now writes nav-title and item.class on its host itself, so the nav no longer binds the item class pipe on it and a standalone c-sidebar-nav-title gets nav-title too. It rebuilds its text when item changes, so a new item replaces the name and class instead of appending to them. classMap() splits the other class strings on whitespace into one key each; cSidebarNavBadge, cSidebarNavIcon and SidebarNavHelper.getIconClass() still return an object. The label icon gets aria-hidden, since a multi-class font icon now renders a glyph inside the link.

The label link rendered only c-nav-label c-active, which no CoreUI stylesheet styles, so it showed as a bare underlined link with the icon above the text. It now also gets nav-link and nav-label: it looks like the other nav links and hides in a narrow sidebar, like titles. c-nav-label and c-active stay.

… and icon class

- title: `class: 'a b'` threw InvalidCharacterError and the whole `c-sidebar-nav` rendered nothing; the title now writes `nav-title` and `item.class` on its host itself (the nav no longer binds the item class pipe on it) and rebuilds its content on item change (was `OneTwo`, stale class kept)
- label (`class`, `icon`, `label.class`), badge (`badge.class`), `cSidebarNavIcon`, `SidebarNavHelper.getIconClass()`: a multi-class string was a single record key and never applied
- `classMap()` splits class strings on ASCII whitespace into record keys; pipes and helper keep their object shape
- label icon `aria-hidden`, now that a font icon glyph renders inside the link
- label `<a>` rendered only `c-nav-label c-active`, which no CoreUI stylesheet styles (v4 dropped the label styles), so it showed as a bare underlined link with the icon above the text and stayed visible in a narrow sidebar
- adds `nav-link` (link padding and colour) and `nav-label` (hidden in a narrow sidebar, like titles); `c-nav-label` and `c-active` stay so selectors on them still match, but `.sidebar-nav .nav-link` now wins where both set a property
@xidedix
xidedix merged commit ae69a88 into v5.7 Oct 19, 2026
9 checks passed
@xidedix
xidedix deleted the fix/sidebar-nav-title-class branch October 19, 2026 13:57
xidedix added a commit that referenced this pull request Oct 19, 2026
- fix(alert): hide and emit `visibleChange` when there is no opacity transition (#304)
- fix(carousel): measure each swipe from its own touchstart (#303)
- fix(collapse.directive): emit `visibleChange` and `collapseChange` when `animate` is false (#292)
- fix(dropdown): mirror the menu placement in a right-to-left context (#299)
- fix(dropdown, modal, offcanvas): Escape in an open dropdown leaves the container open (#298)
- fix(shadow-on-scroll.directive): changing `cShadowOnScroll` drops the old shadow class and scroll listener (#292)
- fix(sidebar): apply input changes after first render, scope state actions to their sidebar (#307)
- fix(sidebar-nav): apply multi-class item classes, style the label as a nav link (#309)
- fix(sidebar-nav-helper): `isActive()` handles array urls (#296)
- fix(sidebar-nav-icon.pipe): handle a missing item (#296)
- fix(table): keep one responsive wrapper and remove it on destroy (#305)
- fix(tabs): Home/End, one key manager, navigate and select by key (#306)
- fix: ignore key events without a key (#302)
- refactor(tab-pane): `OnPush`, signal state, host metadata (#294)
- refactor: drop `ngAcceptInputType_` from signal inputs (#293)
- test: run specs zoneless, drop `zone.js` (#295)
- test: use `TestBed.createDirective()` in directive specs (#292)
- test: cover untested paths across components and services (#300, #301, #308)
- ci: bump `actions/setup-node` (#297)
- chore(dependencies): update to Angular 22.2.3 (#310)

Verified: `npm ci`, lint, tests 30 + 1035 + 60, 3 prod builds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant