EasyCorp / EasyCorp/EasyAdminBundle
[BUG] Action Button without label
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 4.3k
- Forks
- 1.1k
- Avg merge
- 8d 2h
- Merged PRs (30d)
- 11
Description
Describe the bug
With the new Button component action buttons without label rendered wrong.
To Reproduce
public function configureActions(Actions $actions): Actions
{
$testAction = Action::new('test')
->linkToUrl('#')
->setIcon('text-dark fa-fw fa-solid fa-bug')
->setLabel(false);
return $actions
->add(Crud::PAGE_INDEX, $testAction);
}
results:
<a class="btn btn-secondary action-test" href="#" role="button" data-action-name="test" title="test">
<span class="icon btn-icon">
<i class="text-dark fa-fw fa-solid fa-bug"></i>
</span>
<span class="btn-label"></span>
</a>
an extra <span class="btn-label"></span> here
(OPTIONAL) Additional context
in crud/action.html.twig
{%- if outerScope.action.label is not empty -%}<span class="action-label">{{ outerScope.action.label|trans|raw }}</span>{%- endif -%}
does not render an extra <span class="action-label"></span> but makes content defined for Button component, so {% if block('content') is defined %} evaluates to true and renders the extra empty <span class="btn-label"></span>
changing {% if block('content') is defined %} to {% if block('content') is defined and block('content') is not empty %} does fix the rendering
<a class="btn btn-secondary action-test" href="#" role="button" data-action-name="test" title="test">
<span class="icon btn-icon">
<i class="text-dark fa-fw fa-solid fa-bug"></i>
</span>
</a>
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 with the Button component template condition described in the issue and compare it with crud/action.html.twig, where the empty action label is omitted. Verify the rendering with an icon-only action using setLabel(false); done means the generated button no longer contains an empty btn-label span.
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
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100