filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
19.29k stars 2.96k forks source link

Autofocus not working with ->sidebarCollapsibleOnDesktop() #8296

Closed njxqlus closed 1 year ago

njxqlus commented 1 year ago

Package

filament/filament

Package Version

v3.0.39

Laravel Version

v10.22.0

Livewire Version

v3.0.1

PHP Version

8.1

Problem description

->autofocus() doesn't make any effect when ->sidebarCollapsibleOnDesktop() option enabled in AdminPanelProvider

Expected behavior

Autofocus on field on page/form open

Steps to reproduce

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ->default()
            ->sidebarCollapsibleOnDesktop()
           ...
public static function form(Form $form): Form
{
    return $form
        ->schema([
            Forms\Components\TextInput::make('foo')
                ->autofocus(),
            Forms\Components\TextInput::make('bar')
        ]);
}

Please use the autofocus-bug branch in the reproduction repository.

Reproduction repository

https://github.com/njxqlus/filamentphp-bug-report/tree/autofocus-bug

Relevant log output

No response

njxqlus commented 1 year ago

In continuation https://discord.com/channels/883083792112300104/1142039778196455424

danharrin commented 1 year ago

Should be fixed by #8792