FilamentF
Filament2mo ago
1 reply
Asmit

Help: How can I keep the parent modal open when opening the child modal?

I have a parent action that opens a slide-over. Inside that slide-over, a Section has a header action that opens another slide-over. When I open the child slide-over, the parent closes. When I close the child, the parent reopens.

public function viewAction(): Action
{
    return Action::make('view')
        ->modalHeading('View Details')
        ->schema(function ($record) {
            return [
                Section::make('Information')
                    ->schema([
                        TextInput::make('name'),
                        // ... other fields
                    ]),
                Section::make('Notes')
                    ->headerActions([
                        Action::make('addNote')
                            ->button()
                            ->icon('heroicon-o-plus')
                            ->slideOver() // Child slide-over
                            ->schema(function ($form) use ($record) {
                                return $form->schema([
                                    Textarea::make('note')
                                        ->required(),
                                ]);
                            })
                            ->action(function (array $data) use ($record) {
                                // Save note logic
                            }),
                    ])
                    ->schema([
                        // Display existing notes
                    ]),
            ];
        })
        ->slideOver(); // Parent slide-over
}


Expected behavior:
Parent slide-over stays open when the child opens
Both slide-overs visible simultaneously (stacked)

Actual behavior:
Parent closes when child opens
Parent reopens when child closes

Is there a way to prevent the parent from closing, or should I use a different approach?
Was this page helpful?