Content
View differences
Updated by Alexander Coles 7 days ago
## Context
Primer ActionMenu/ActionList has no group-level emptiness handling: a group with no (visible) items still renders its chrome, and dividers between sections must be managed by the caller. OpenProject carries two workarounds for this gap:
*
- `OpPrimer::ComponentHelpers#with_item_group` (`app/components/op_primer/component_helpers.rb:79-90`) inserts dividers between sections at render time and pops the divider again when a section produced no items.
*
- #AGILE-364 toggles `hidden` on group `<ul>` elements client-side when every item inside is hidden, so an all-hidden batch group does not remain as an empty labelled group in the menu.
## Goal
Upstream group-emptiness behavior into the fork (`opf/primer_view_components`) and propose it to `primer/view_components`, so both workarounds can eventually be deleted:
*
- Render time: a group (or divider-separated section) that ends up with no items renders nothing — no divider, heading, or list chrome. The `with_item_group` semantics are a proven shape for the API.
*
- Runtime (stretch, aligns with #AGILE-364): when every item of a group is hidden dynamically, the group hides itself, including its heading and any adjacent divider, and reappears when an item becomes visible again.
## Acceptance criteria
* - An ActionMenu/ActionList group with zero rendered items produces no divider, heading, or group markup.
*
- Dividers between populated sections render exactly once, without caller-side bookkeeping.
*
- Documented behavior (Lookbook/preview) plus component test coverage for empty, partially hidden, and fully hidden groups.
*
- PR opened against `opf/primer_view_components`
* `opf/primer_view_components`; proposal (issue or PR) filed against `primer/view_components`.
- Follow-up notes identifying the OpenProject call sites that can drop `with_item_group` and the #AGILE-364 client-side group toggling once released.
## Notes
Related bug for the same menu: hidden group headings still name their groups through `aria-labelledby` (#DREAM-809). The runtime-hiding stretch goal should not regress that fix.
Primer ActionMenu/ActionList has no group-level emptiness handling: a group with no (visible) items still renders its chrome, and dividers between sections must be managed by the caller. OpenProject carries two workarounds for this gap:
*
-
*
-
Upstream group-emptiness behavior into the fork (`opf/primer_view_components`) and propose it to `primer/view_components`, so both workarounds can eventually be deleted:
*
-
*
-
*
*
-
*
-
*
-
*
-
Related bug for the same menu: hidden group headings still name their groups through `aria-labelledby` (#DREAM-809). The runtime-hiding stretch goal should not regress that fix.