Keybinding doesn't work after the first time

My idea is to use a modal to shoot tickets with an optical gun. The system is working, but when I open the modal, fill the user number (or shoot it with the gun) and press "enter", everything works and the modal stays open. But on the second insertion, if I press enter nothing happens, but if I press the button it works fine, but it loses autofocus on the form field. Could the problem be related to $action->halt()? Thank you This is my code in listPage
protected function getHeaderActions(): array
{
return [
Action::make('register_attendances')->label('Registra Presenza')
->form([
Section::make()
->schema([
TextInput::make('participant_id')
->autofocus()->numeric()->required()->label('Id Partecipante'),
])
])
->modalSubmitAction(false)
->extraModalFooterActions(fn(Action $action): array => [
$action->makeModalSubmitAction('registra', arguments: ['halt' => true])
->label('Registra')
->color('primary')
->keyBindings(['command+s', 'ctrl+s', 'enter'])
])
->action(function ($action, $record, $data, $arguments, $form) {
$attendance = Attendance::firstOrCreate($data);
$form->fill();
$action->halt();
})
];
}
protected function getHeaderActions(): array
{
return [
Action::make('register_attendances')->label('Registra Presenza')
->form([
Section::make()
->schema([
TextInput::make('participant_id')
->autofocus()->numeric()->required()->label('Id Partecipante'),
])
])
->modalSubmitAction(false)
->extraModalFooterActions(fn(Action $action): array => [
$action->makeModalSubmitAction('registra', arguments: ['halt' => true])
->label('Registra')
->color('primary')
->keyBindings(['command+s', 'ctrl+s', 'enter'])
])
->action(function ($action, $record, $data, $arguments, $form) {
$attendance = Attendance::firstOrCreate($data);
$form->fill();
$action->halt();
})
];
}
2 Replies
heisenberg1988
heisenberg1988OP15mo ago
The x-mousetrap is preset in HTML generated
No description
heisenberg1988
heisenberg1988OP15mo ago
any help please?
Want results from more Discord servers?
Add your server