[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayInput: Adding a line doesn't focus the first inputs if it's an AutocompleteInput #7643

Open
fzaninotto opened this issue May 5, 2022 · 1 comment
Labels

Comments

@fzaninotto
Copy link
Member
fzaninotto commented May 5, 2022

What you were expecting:

When a user presses the AddItemButton on a SimpleFormIterator inside an ArrayInput, the first input of the new line is focused

What happened instead:

The first input is focused only if it's a TextInput. For an AutocompleteInput, the focus goes on the second input.

Enregistrement.de.l.ecran.2022-05-05.a.12.32.31.mov

Steps to reproduce:

I added a story to demonstrate the problem:

const BookEditWithAutocomplete = () => {
return (
<Edit
mutationMode="pessimistic"
mutationOptions={{
onSuccess: data => {
console.log(data);
},
}}
>
<SimpleForm>
<ArrayInput source="authors" fullWidth>
<SimpleFormIterator>
<AutocompleteInput
source="role"
choices={[
{ id: 'head_writer', name: 'Head Writer' },
{ id: 'co_writer', name: 'Co-Writer' },
]}
/>
<TextInput source="name" />
</SimpleFormIterator>
</ArrayInput>
</SimpleForm>
</Edit>
);
};

test it online at https://react-admin-storybook-plcbp0yhi-marmelab.vercel.app/?path=/story/ra-ui-materialui-input-arrayinput--autocomplete-first

Environment

  • React-admin version: v4
  • Last version that did not exhibit the issue (if applicable): v3
  • React version: 17
  • Browser: Chrome
@djhi
Copy link
Contributor
djhi commented May 23, 2022

Actually, we have the same issue with some other components such as the DateInput. That can be seen on the simple example (create a post, add a backlink)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants