Skip to content

Unable to disable autoFocus for new item in <SimpleFormIterator /> #10946

@smeng9

Description

@smeng9

What you were expecting:

I have a TextInput inside <SimpleFormIterator /> of the ArrayInput.
If I set the autoFocus property to false, I expect it will not be focused when clicking the add button from the SimpleFormIterator

What happened instead:

The input field is always autoFocused, there is no way to disable it.

Steps to reproduce:

Create an ArrayInput with SimpleFormIterator and some TextInput inside. The TextInput explicitly has autoFocus set to false.
When clicking the add button in the SimpleFormIterator, it still gets the focus, which is not the expected behavior.

Related code:

https://codesandbox.io/p/github/marmelab/react-admin-sandbox/csb-8g7h49/draft/wizardly-haslett?file=%2Fsrc%2Fposts%2FPostCreate.tsx%3A150%2C22-150%2C40

Other information:

Environment

  • React-admin version: 5.11.2
  • Last version that did not exhibit the issue (if applicable):
  • React version: 19.1.0
  • Browser: Safari 17.5
  • Stack trace (in case of a JS error):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions