EasyCorp / EasyCorp/EasyAdminBundle
Empty "Actions" column shown in index when a row has no enabled actions
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 4.3k
- Forks
- 1.1k
- Avg merge
- 8d 2h
- Merged PRs (30d)
- 11
Description
Description
On the INDEX page, EasyAdmin always renders the trailing "Actions" table column for every row, even when the entity has no actions available at all (e.g. all of NEW / EDIT / DELETE disabled, and DETAIL not added to the row). The result is an empty, wasted column that shows nothing and adds horizontal clutter — especially noticeable on a read-only list.
Root cause
In templates/crud/index.html.twig the td is unconditionally emitted, while its content is gated on the actions count:
<!-- line 168 -->
<td class="actions {{ ea.crud.showEntityActionsAsDropdown ? 'actions-as-dropdown' }}">
{% if entity.actions.count > 0 %}
... render the action menu ...
{% endif %}
</td>
When entity.actions.count == 0 the cell is rendered empty (and this is also an unused empty th header).
Expected behaviour
When no row action is available for an entity (no enabled actions across the table), the Actions column (both the header th and every row td) should be omitted entirely, rather than rendered empty.
Suggested fix
Only render the Actions th/td when at least one entity has actions, e.g. compute a page-level flag (like the existing has_batch_actions) such as {% set has_entity_actions = ... %} and wrap the header/row cell in it.
Reproduction steps
- Create a CRUD controller.
- Disable all actions that would appear on the index rows:
return $actions
->disable(Action::DELETE)
->remove(Action::INDEX, Action::NEW)
->remove(Action::INDEX, Action::EDIT)
->remove(Action::DETAIL, Action::EDIT);
- Open the
INDEXpage — a trailing empty "Actions" column is shown.
Environment
- EasyAdmin v5.5.1
- Symfony v7.4.17
- PHP 8.3
- Browser Firefox / Chromium (verified headless)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in templates/crud/index.html.twig and reproduce the INDEX page with all row actions disabled as described. Inspect the Actions header and row cell conditions, then verify that both are omitted when no entity has actions while remaining available when at least one row action exists.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, symfony
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100