Repository navigation
fix(modern): hide the card and column menus when every action is hidden - #225
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A user who may not run any card action no longer gets an empty menu on a Modern board card. Before, a card whose actions were all hidden (for example by a policy check) still rendered the three-dot trigger, and opening it showed an empty dropdown. Relaticle hit this with its viewer role: on a phone the empty dropdown opens as a dimmed screen with an empty bottom sheet. Column header menus had the same defect.
What changed
resources/views/modern/livewire/card.blade.phprenders the action group only when at least one record action is visible, and passes only the visible ones to it.resources/views/modern/livewire/column-header.blade.phpfilters column actions to the visible ones before choosing between a single action, a group, or nothing.Why this way
Filament's
ActionGroup::toHtml()renders the dropdown without checking whether the group as a whole is hidden, so the decision has to happen before the group is built. The filter sits in the views, not ingetBoardRecordActions():getCardLink()reads the full list and relies on finding a hidden card action to return no link. Dropping hidden actions at the source would make it fall back to mounting the card action instead.Behavior to know about
bin/classic-gate.shpasses.Tests
tests/Modern/Feature/CardShellTest.phpadds two tests on a newTestHiddenActionsBoardfixture whose card and column actions are all hidden: the card renders withoutff-card-actions, and the column header renders withoutff-column-actions. Both fail without the view changes.Checked
On
ec65662a5: Pint passes, the classic gate passes, and Feature, Modern and Unit run 633 tests green. PHPStan reports 10 errors locally both with and without this change, so CI is the verdict there.Not checked
The browser suite (Chromium and WebKit) runs in CI only.