© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
5 replies
Lukas

Focus on Action Modal open?

Hi, is it possible to focus a form field after a action modal is opened?

I use AlpineJS dispatch an Event which opens the Modal and I'm able to pass in the name of the field which is needed to be focused.

But I'm not sure if it's possible currently, I know I can execute PHP code when the modal is opened. However I probably need to execute some JS.

I also tried using
->autofocus()
->autofocus()
on the form fields with a Closure that checks which field to focus, like:

->autofocus(fn() => $this->autofocus === 'field-name')
->autofocus(fn() => $this->autofocus === 'field-name')


But autofocus seems not to do anything in modals.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Open action modal
FilamentFFilament / ❓┊help
3y ago
Open custom modal action on record click
FilamentFFilament / ❓┊help
2y ago
Modal on action
FilamentFFilament / ❓┊help
2y ago
Open url in modal action
FilamentFFilament / ❓┊help
2y ago