# Implementation AGILE-481 - Refresh deferred ActionMenu content via src

Project: Stream agile
Status: closed
URL: https://community.openproject.org/work_packages/AGILE-481

## OPEN POINTS

_No work packages_

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Designer |  |
| Developers | Alexander Coles |

## Technical details

| Attribute | Value |
| --- | --- |
| Target versions | 18.0.0 |
| Module | Frontend components and Primer design system, Modules and project features / Backlogs |
| Requires doc change | No |

## Belongs to

_No work packages_

## Previous chunks

_No work packages_

## Next chunks

_No work packages_

## Estimates

| Attribute | Value |
| --- | --- |
| Effort (shirt size) |  |
| Work |  |

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| % Complete | 100% |
| Category |  |
| Sprint |  |
| Backlog bucket |  |
| Priority | Medium |
| List | a11y report 2026 |
| Pull preview |  |
| Labels |  |

## Description

## What to build

Let a deferred Primer `ActionMenu` reload its items from the server. Today a menu rendered with `src:` loads once through `<include-fragment>`, which replaces itself on success, so the menu cannot be refreshed afterwards. This is the Primer prerequisite for reworking <mention class="mention" data-id="AGILE-364" data-type="work_package" data-text="#AGILE-364">#AGILE-364</mention> so that the server, not client logic, decides which card-menu actions a selection gets.

The change lives in the OpenProject fork of Primer ViewComponents (opf/primer\_view\_components). Upstream `include-fragment-element` stays unchanged.

## Acceptance criteria

- [ ] Changing the `src` attribute on `<action-menu>` reloads the menu's items from the new URL. A closed menu applies the change when it next opens, keeping its current items, label and inputs until then (immediately when preloaded); an open menu reloads in place, stays open, and keeps focus inside the menu.
- [ ] Setting an unchanged `src` does nothing. A menu whose last load failed retries when it next opens; while open, setting the same `src` retries at once. A blank or removed `src` keeps the current items.
- [ ] An `<include-fragment>` inserted directly into the menu by other code, such as a Turbo morph, is picked up and loads normally.
- [ ] Only the response to the latest `src` is shown, whatever order responses arrive in.
- [ ] After a load, the dynamic button label and hidden form inputs reflect the server-rendered selection, including on the first load.
- [ ] Closing a sub-menu releases its focus trap (existing bug).
- [ ] Menus that never refresh, and deferred sub-menus, keep their current markup and behaviour.

## Known gap (2026-11-01)

  - After a Turbo morph inserts a fresh lazy `<include-fragment>` into an already loaded menu, the fragment is adopted but does not fetch when the menu reopens with an unchanged `src`; the menu stays on its loading placeholder (no request, no `data-ready`). Found by the OpenProject card-menu rebuild (<mention class="mention" data-id="AGILE-364" data-type="work_package" data-text="#AGILE-364">#AGILE-364</mention>), which keeps `action-menu-morph-remount.ts` until this is fixed. The acceptance criterion on adopting inserted fragments is therefore not met yet.

## Sequencing notes

  - The OpenProject side, a list-level `beforetoggle` controller that sets `src` from the settled selection, belongs to the <mention class="mention" data-id="AGILE-364" data-type="work_package" data-text="#AGILE-364">#AGILE-364</mention> rework, as does Turbo snapshot recovery and possibly retiring `action-menu-morph-remount.ts`.
