© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
11 replies
Eric

Why the autofocus doesnt work on modals?

Why the autofocus doesnt work on modals?

I open up the modal, but the text input is not focused, should be focused automatically, or i am wrong?
if im wrong, how would be the workaround to achieve to be focused when the modal opens up?

Forms\Components\Select::make('genre')
    ->relationship(name: 'genre', titleAttribute: 'name')
    ->createOptionForm([
        Forms\Components\TextInput::make('name')
            ->required()
            ->unique(Genre::class, 'name')
            ->autofocus()
        ,
    ])
,
Forms\Components\Select::make('genre')
    ->relationship(name: 'genre', titleAttribute: 'name')
    ->createOptionForm([
        Forms\Components\TextInput::make('name')
            ->required()
            ->unique(Genre::class, 'name')
            ->autofocus()
        ,
    ])
,
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

->autofocus doesnt work with modals
FilamentFFilament / ❓┊help
3y ago
Autofocus() on modals
FilamentFFilament / ❓┊help
2y ago
Why doesnt livewire:click work on modal?
FilamentFFilament / ❓┊help
8mo ago
Autofocus on tabs?
FilamentFFilament / ❓┊help
3y ago