Skip to content

fix: Honor visible()/hidden() on comment actions and default size to xs - #123

Merged
luisdalmolin merged 1 commit into
mainfrom
fix/120-comment-action-visibility
Sep 12, 2026
Merged

luisdalmolin merged 1 commit into
mainfrom
fix/120-comment-action-visibility

Conversation

@luisdalmolin

Copy link
Copy Markdown
Member

Closes #120.

Problem

Two issues with custom comment actions:

  1. visible() / hidden() disable instead of hide. Filament's icon-button toHtml() does not skip hidden actions — it only checks isDisabled(), and isDisabled() returns true when the action is hidden. Rendering {{ $action }} therefore produced a disabled button. The same applied to edit/delete for users who cannot update/delete.

  2. Default size is larger than edit/delete. Built-in actions set size('xs'). Custom actions used Filament's medium default unless the host set size explicitly.

Fix

  • Only render comment actions when isVisible() is true
  • Apply defaultSize('xs') to custom actions so they match edit/delete unless the host overrides with ->size()

Tests

  • Hidden custom actions are absent from the HTML (including visible() closures that inspect the comment)
  • Visible custom actions still render
  • Default size is xs; an explicit size('sm') is preserved
  • Unauthorized edit/delete labels are not in the HTML

Full suite: 174 passed. Pint clean. PHPStan unchanged — the 7 pre-existing errors in tests/Livewire/CommentReactionTest.php are also present on main.

Filament icon-button actions render hidden actions as disabled rather
than omitting them. Skip rendering actions that are not visible so
visible()/hidden() actually hide the button.

Custom actions also inherit defaultSize('xs') to match edit/delete.
@luisdalmolin
luisdalmolin merged commit ff7f49a into main Sep 12, 2026
20 checks passed
@luisdalmolin
luisdalmolin deleted the fix/120-comment-action-visibility branch September 12, 2026 10:37
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.

Visibility of Comment Actions

1 participant